Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. SELECT
  2. Tw.tw_Id,
  3. Tw.tw_Symbol,
  4. Tw.tw_Nazwa,
  5. Stan = SUM(Tw.Stan),
  6. Rezerwacja = SUM(Tw.Rezerwacja),
  7. Dostepne = SUM(Tw.Dostepne),
  8. cena = MIN(Tw.tc_CenaNetto{0}),
  9. cena_brutto = MIN(Tw.tc_CenaBrutto{0}),
  10. EAN = ISNULL(kod.kk_Kod, '')
  11. FROM
  12. vwTowar AS Tw
  13. LEFT JOIN
  14. tw_KodKreskowy AS kod ON kod.kk_IdTowar = Tw.tw_Id
  15. WHERE
  16. (
  17. st_MagId = {1}
  18. OR
  19. st_magId IN ( SELECT mag_id FROM dbo.sl_Magazyn WHERE mag_Symbol IN ({2}) )
  20. OR
  21. st_MagId IS NULL
  22. )
  23. AND
  24. Tw.tw_SklepInternet = 1
  25. GROUP BY
  26. Tw.tw_Id, Tw.tw_Symbol, Tw.tw_Nazwa, kod.kk_Kod
  27. ORDER BY Tw.tw_Symbol ASC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement