Jump to content

Distinct & Limit Not Working


elabuwa

Recommended Posts

Hi guys,

 

DB is mysql.

I have the below query i'm trying to run through PHP.

 

$sql = "SELECT DISTINCT pid FROM campaign_details WHERE camp_id='$camp_id' LIMIT 7";
$newquery = mysql_query($sql) or die(mysql_error());

 

There are 10 ditinct PID values but I want only 7.

The stupid thing returns all of them when I need to limit them at 7.

 

Any work around this?

Or Do I need to go and take a coffee break and have another look? haha.

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/250912-distinct-limit-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.