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
https://forums.phpfreaks.com/topic/120506-sql-like-please-need-some-help/
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.