Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
jayson.ph
Forum Contributor
Posts: 165 Joined: Mon Jan 02, 2012 9:20 am
Location: MP
Contact:
Post
by jayson.ph » Wed Jul 11, 2012 8:37 pm
Hi all,
i any advice for the correct syntax for this. iknow you read it and understand it.
Code: Select all
("SELECT DISTINCT COUNT(item_name),cat_id,productid FROM tbl_itemdescription WHERE cat_id = '$cat' GROUP BY item_name HAVING COUNT(item_name) = '1' ORDER BY item_name ");
Thanks
tr0gd0rr
Forum Contributor
Posts: 305 Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA
Post
by tr0gd0rr » Thu Jul 12, 2012 1:38 pm
I don't think you can have a DISTINCT COUNT(). If you are aggregating and grouping by, you should already get DISTINCT values