Display complex search results to show best match

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
muppet
Forum Newbie
Posts: 22
Joined: Sun Jan 25, 2004 2:01 pm

Display complex search results to show best match

Post by muppet »

I have a table that holds:
from_postcode
to_postcode
wagon_type
move_date
load_value
load_status

I'm querying the table to find all the loads that are from or to a location, of a certain wagon type, the move date is between 2 dates and the load status is available. I use the following where clause

WHERE (from_pc = '%s' or loads.to_pc = '%s') AND (loads.type_wagon like '%s' AND loads.move_date >= '%s' AND loads.move_date <= '%s' AND loads.load_value <= %s AND load_status = 'Available')

I'm achieving the desired results but I need to be able to display them with the best match first, as you would see in full text search results but I don't think full text searching is going to work on this or is it????

Any help greatfully recieved.
:roll:
muppet
Forum Newbie
Posts: 22
Joined: Sun Jan 25, 2004 2:01 pm

Sorted!!!!!!!!

Post by muppet »

Full text won't work because my postcode data is only 2 characters - DOH!!!!

However, an SQL case statement allows me to specify the order in which to display the results.

WOO HOO!!!!! :D
Post Reply