SELECT distinct(product_id), id
FROM stock_move
WHERE date >= '2019-09-24 00:00:00'
and date <= '2019-09-24 23:59:59'
with this query, I still, get results like
|250, 1256
|250, 1257
|259, 1258
but I don't want to select duplicates. so from first to rows, I need just one to be selected. How can I aceave this?
Desired output.
|250, 1256
|259, 1258
distinctis NOT a function. It always applies to all columns in the SELECT list. Putting parentheses around one column won't change that.distinct (a),bis exactly the same asdistinct a, (b)ordistinct a,b- you are probably looking fordistinct on ()