0
мой запрос так,Group по и дело
SELECT
a.Tarih
,'Gebze Fabrika' as [Departman]
,SUM(CONVERT(int,a.[KKTShirtAdet])*z.TxtKKTShirtFiyat) as [Kısa Kollu TShirt (TL)]
,(SELECT SUM(Convert(int,b.[UKTShirtAdet])) FROM [E_WBR_ISK_FrmFabrikaMudurleri_TblRapor] b WHERE b.[UKTShirtBeden]<>'1' and a.Tarih=b.Tarih and case when a.[DepartmanAdi] like '%GEBZE%' then a.[DepartmanAdi] end=case when b.[DepartmanAdi] like '%GEBZE%' then b.[DepartmanAdi] end
GROUP BY case when b.[DepartmanAdi] like '%GEBZE%' then b.[DepartmanAdi] end,b.Tarih)*z.TxtUKTShirtFiyat as [Uzun Kollu TShirt (TL)]
,SUM(CASE WHEN PantolonBeden<>'1' and DepartmanAdi like '%GEBZE%' THEN z.TxtPantolonFiyat ELSE 0 END) as [Pantolon (TL)]
,SUM(CASE WHEN [CelikBurunlu]='Ayakkabı' and AyakkabiNo<>'' and DepartmanAdi like '%GEBZE%' THEN z.TxtCBAyakkabiFiyat ELSE 0 END) as [Çelik Burunlu Ayakkabı (TL)]
,SUM(CASE WHEN [CelikBurunlu]='Çizme' and AyakkabiNo<>'' and DepartmanAdi like '%GEBZE%' THEN z.TxtCBCizmeFiyat ELSE 0 END) as [Çelik Burunlu Çizme (TL)]
,SUM(CASE WHEN [CelikBurunlu]='Terlik' and AyakkabiNo<>'' and DepartmanAdi like '%GEBZE%' THEN z.TxtCBTerlikFiyat ELSE 0 END) as [Çelik Burunlu Terlik (TL)]
,(SELECT SUM(CASE WHEN c.[OnlukCins]='Bay' THEN Convert(int,c.[OnlukAdet]) ELSE 0 END) FROM [E_WBR_ISK_FrmFabrikaMudurleri_TblRapor] c WHERE c.[OnlukBeden]<>'1' and a.Tarih=c.Tarih and case when a.[DepartmanAdi] like '%GEBZE%' then a.[DepartmanAdi] end=case when c.[DepartmanAdi] like '%GEBZE%' then c.[DepartmanAdi] end
GROUP BY case when c.[DepartmanAdi] like '%GEBZE%' then c.[DepartmanAdi] end,c.Tarih)*z.TxtBayOnlukFiyat as [Bay Önlük (TL)]
,(SELECT SUM(CASE WHEN d.[OnlukCins]='Bayan' THEN Convert(int,d.[OnlukAdet]) ELSE 0 END) FROM [E_WBR_ISK_FrmFabrikaMudurleri_TblRapor] d WHERE d.[OnlukBeden]<>'1' and a.Tarih=d.Tarih and case when a.[DepartmanAdi] like '%GEBZE%' then a.[DepartmanAdi] end=case when d.[DepartmanAdi] like '%GEBZE%' then d.[DepartmanAdi] end
GROUP BY case when d.[DepartmanAdi] like '%GEBZE%' then d.[DepartmanAdi] end,d.Tarih)*z.TxtBayanOnlukFiyat as [Bayan Önlük (TL)]
FROM [E_WBR_ISK_FrmFabrikaMudurleri_TblRapor] a, [E_WBR_ISK_PrmFiyatlar] z
WHERE a.[KKTShirtBeden]<>'1' and DepartmanAdi like '%GEBZE%' and a.Tarih='17.6.2016'
GROUP BY case when a.[DepartmanAdi] like '%GEBZE%' then a.[DepartmanAdi] end,a.Tarih,z.TxtUKTShirtFiyat,z.TxtBayOnlukFiyat,z.TxtBayanOnlukFiyat
и результат в приложении, есть несколько строк, и я хочу только одну строку, как я могу это сделать, пожалуйста, помогите мне. Спасибо.
я не хочу топ 1 линия, я хочу линию суммирования количеств – newusereser