
03-21-10, 17:52
|
|
vaguely human
|
|
Join Date: Jun 2007
Location: London
Posts: 2,517
|
|
Quote:
Originally Posted by mmcknight
Does anyone have any tips on how I can better optimize this query?
|
It's very difficult to make sense out of your SQL so I'll just make a few points:- using a GROUP BY clause when it's not required
- putting wilcards around your unique id looks very wrong - c1 LIKE '%{$_GET['uniqueid']}%') - this will result in a table scan each time and ids like 99 will match against ids 99, 199, 299, 991 etc.
- the code after the IN clause is a mess - what on earth are you trying to do there?
- the first part of your where clause has (SELECT DISTINCT mls_listings.c1 = mls_listings_images.c1) which seems nonsensical.
- you could work on your field names (c1 ... c9) to give them a little more meaning.
- what happens if PHP doesn't have a value for any of these parameters ie ehat happens if beds is left blank in (mls_listings.c5 >= '{$_GET['beds']}')
|
|