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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.