22/04/2018, 20:31
dabanli
Merhaba Arkadaslar
Hepinizi kolay gelsin
yapmak istedigim sey
SELECT U.URUN_ID, U.URUN_ADI,U.KOLI_ADET,U.PAKET_ADET FROM URUNLER U LEFT JOIN
(SELECT URUN_ID, Sum(TOP_MIKTAR), "1" FROM ALIMLAR Where CARI_ID=60 group by URUN_ID UNION SELECT URUN_ID, Sum(TOP_MIKTAR), "2" FROM CARI_SATISLAR Where CARI_ID=60 group by URUN_ID UNION SELECT URUN_ID, Sum(TOP_MIKTAR), "3" FROM TOPTANCIYA_IADELER Where CARI_ID=60 group by URUN_ID) ON U.URUN_ID=QUERY1.URUN_ID ;
burda Query1 degilde union tablosuna bi isim verip onu kullanmam gerekiyor sanirim
yada tamamen sacmaladim...
Hepinizi kolay gelsin
yapmak istedigim sey
SELECT U.URUN_ID, U.URUN_ADI,U.KOLI_ADET,U.PAKET_ADET FROM URUNLER U LEFT JOIN
(SELECT URUN_ID, Sum(TOP_MIKTAR), "1" FROM ALIMLAR Where CARI_ID=60 group by URUN_ID UNION SELECT URUN_ID, Sum(TOP_MIKTAR), "2" FROM CARI_SATISLAR Where CARI_ID=60 group by URUN_ID UNION SELECT URUN_ID, Sum(TOP_MIKTAR), "3" FROM TOPTANCIYA_IADELER Where CARI_ID=60 group by URUN_ID) ON U.URUN_ID=QUERY1.URUN_ID ;
burda Query1 degilde union tablosuna bi isim verip onu kullanmam gerekiyor sanirim
yada tamamen sacmaladim...