code_junkie

Using 'distinct' in a MySQL query

Nov 14th, 2011
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. "SELECT p.author_name, p.author_id, DISTINCT p.topic_id, t.title
  2. FROM `ibf_posts` p, `ibf_topics` t WHERE p.topic_id = t.tid ORDER BY pid DESC LIMIT 8"
  3.  
  4. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT p.topic_id, t.title FROM `ibf_posts` p, `ibf_topics` t WHERE p' at line 1
  5.  
  6. SELECT DISTINCT ...
Add Comment
Please, Sign In to add comment