SELECT tw_Id, tw_Nazwa, tw_Symbol, SUM(st_Stan) FROM tw__Towar LEFT JOIN tw_Stan ON tw__Towar.tw_Id=tw_Stan.st_TowId WHERE tw_Id=6 GROUP BY tw_Id
I wywala błąd:
Kod
Msg 8120, Level 16, State 1, Line 1
Column 'tw__Towar.tw_Nazwa' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Column 'tw__Towar.tw_Nazwa' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Chcę wyrzucić towar o ID = 6 i policzyć jego STAN z drugiej tabeli - gdzie występują dwa rekordy o tym ID...
Nawet gdy dam zapytanie:
SELECT tw_Id, tw_Nazwa, tw_Symbol FROM tw__Towar WHERE tw_Id=6 GROUP BY tw_Id
I wywala to samo... mimo, że tutaj brak jakiś nie jasności... Proszę was o pomoc.
Dziękuje i pozdrawiam