Jump to content

LIKE Clause On Joined tables


tomtimms

Recommended Posts

I am trying to do a like clause on a joined table, below is my query.

 

SELECT SQL_CALC_FOUND_ROWS source, id, gross, id32 FROM ( ( SELECT a.source, a.id, a.gross, b.id32  FROM table1 a LEFT JOIN table2 b ON (a.source = b.id32 AND a.id = b.id32) WHERE a.date BETWEEN '2011-01-01' AND '2011-01-05' AND b.id32 LIKE '%201%' GROUP BY a.source,a.id )) AS tmp GROUP BY source,id

 

The query doesn't give an error, however it just takes over 100 seconds to process.  Anyone know what I could do to optimize this? 

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.