Reputation: 338
I have a selector where I wish users to only see distinct 'items' from a table. Below I have code to loop through the results. If I change the query to SELECT * it works perfectly fine.
SELECT DISTINCT set FROM trail ORDER BY category
Is DESTINCT depreciated? I can't figure out why it wouldn't work.
I have come here after checking other peoples questions regarding this topic. I Tried adding two columns and that displayed nothing as well.
Upvotes: 1
Views: 38
Reputation: 77866
set
is a reserve word and so needs escaping like below. Moreover, refrain yourself from using any reserve word (or) key word as your table column name.
SELECT DISTINCT `set` FROM trail ORDER BY category
Upvotes: 1