Jump to content

LIMIT Join


dreamwest

Recommended Posts

I need to limit and order  this join by id (primary key) to 40 queries is there a way i can do this??

 

Is this even possible??

 

$query = "SELECT gallery_import.*, video.* ".
"FROM gallery_import, video ".
"WHERE gallery_import.description_import = video.title ORDER BY `video`.`id` DESC  LIMIT 40";
$result = mysql_query($query) or die(mysql_error());

Link to comment
Share on other sites

no errors....its just buggy keeps overwriting values i dont want it to , maybe its how the query is structured.....but your right the limit works

 

The reason i have to modify it is because it taking over 7 minuets to execute, and my site is database driven so i cant acess the site while the scripts running, and i need to run this every 20mins

Link to comment
Share on other sites

Bit stuck with the INDEX creation, heres what ive got

 

mysql_query("CREATE INDEX description_index ON gallery_import(description_import)")
or die(mysql_error()); 

 

but im getting this error:

 

BLOB/TEXT column 'description_import' used in key specification without a key length

 

 

gallery_import is the table name

Link to comment
Share on other sites

Oh my... joining on BLOB fields... no wonder it is slow...

 

CREATE INDEX description_index ON gallery_import(description_import(indexLength))

 

Instead of indexLength put number of characters you want to have indexed.

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.