[thelist] [mysql] select query

kris burford kris at midtempo.net
Thu Jun 10 06:33:11 CDT 2004


I'm smacking my head against the screen over the an sql statement for an 
exchange system (for tickets) and could do with some guidance.

i'm matching a buyer and seller, and one of the checks is to see whether 
either want only to "meet up" (i.e. *not* post their tickets/cheque). if 
this is the case, then their location has to match. so my sql statement 

SELECT blah blah blah
WHERE (seller has the tickets that buyer wants) and CASE WHEN (s.exchange = 
1 or b.exchange = 1) THEN (s.location = b.location) END
ORDER by s.seller_entry_date, b.buyer_entry_date

it's the CASE WHEN ... THEN ... END which is causing me grief. i'll get a 
row returned if i remove the CASE clause but 0 rows with it.

is this possible in mysql? anyone got any ideas?


More information about the thelist mailing list