fuadhamidov
Programmer
hi
i select a number of column, one of which is sum. so i need to use group by clause. at simple logic primery key should be enough, but it gives error so need to print all column name in group by clause
i think trader.id (primery key ) should be enough.
but it does not.
is there any way
i select a number of column, one of which is sum. so i need to use group by clause. at simple logic primery key should be enough, but it gives error so need to print all column name in group by clause
Code:
SELECT trader.name, trader.surname, trader.bagkur_no, trader.father_name,
trader.birth_place, DATEPART( yyyy, trader.birth_date) AS birth_year,
trader.address, sum( amount) AS amount
FROM purchase
INNER JOIN trader ON purchase.producer_id = trader.id
GROUP BY trader.id, trader.name, trader.surname, trader.bagkur_no, trader.father_name,
trader.birth_place, DATEPART( yyyy, trader.birth_date), trader.address
ORDER BY trader.id
i think trader.id (primery key ) should be enough.
but it does not.
is there any way