Advice for the correct syntax?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
jayson.ph
Forum Contributor
Posts: 165
Joined: Mon Jan 02, 2012 9:20 am
Location: MP
Contact:

Advice for the correct syntax?

Post by jayson.ph »

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
User avatar
tr0gd0rr
Forum Contributor
Posts: 305
Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA

Re: Advice for the correct syntax?

Post by tr0gd0rr »

I don't think you can have a DISTINCT COUNT(). If you are aggregating and grouping by, you should already get DISTINCT values
Post Reply