Jump to content

sql like, please need some help


jonnyw6969

Recommended Posts

Hi all,

 

Need a bit of help figuring this out.

 

Im running a simple query on a database of about 5000 records.

 

Its basically looking for matches on a number sequence using the like command.

 

Prob is i have two like commands and the results are limited to 10.

 

 

Here is my query

 


SELECT * FROM number_list a JOIN website_costs b ON a.Prefix=b.Prefix AND a.Category=b.Category WHERE a.Availability = 'A' and a.Prefix = '".$prefix."' and  (a.Number LIKE '%".$_REQUEST['cat']."%' or a.Number LIKE '%".$shortnum."%' )  LIMIT 10

 

The thing is there are results in the database that match the first like command but they dont get picked as there are results from the second like query before them.

 

I need to be able to take all the results from the first like command first then the rest of the results from the second like command.

 

Does this make any sense?

 

Thanks all

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.