Something like that? SELECT `Listing` . * FROM `Listing` LEFT JOIN `CurrencyItem` ON `Listing`.`CurrencyID` = `CurrencyItem`.`ID` WHERE IF( `CurrencyItem`.`Name` = 'NZD', `Listing`.`ProductPrice` > '0' AND `Listing`.`ProductPrice` < '10000', 1) AND IF( `CurrencyItem`.`Name` = 'USD', `Listing`.`ProductPrice` > '0' AND `Listing`.`ProductPrice` < '5348', 1) AND IF(`CurrencyItem`.`Name` = 'AUD', `Listing`.`ProductPrice` > '0' AND `Listing`.`ProductPrice` < '8004', 1) LIMIT 0 , 10
Also you can try use OR instead AND, for given result which you wish 2009/2/11 Cam Spiers <[email protected]>: > Hi I was wondering if this type of query is possible? > > SELECT `Listing` . * > FROM `Listing` > LEFT JOIN `CurrencyItem` ON `Listing`.`CurrencyID` = > `CurrencyItem`.`ID` > WHERE > IF `CurrencyItem`.`Name` = 'NZD' > THEN `Listing`.`ProductPrice` > '0' > AND `Listing`.`ProductPrice` < '10000' > ELSEIF `CurrencyItem`.`Name` = 'USD' > THEN `Listing`.`ProductPrice` > '0' > AND `Listing`.`ProductPrice` < '5348' > ELSEIF `CurrencyItem`.`Name` = 'AUD' > THEN `Listing`.`ProductPrice` > '0' > AND `Listing`.`ProductPrice` < '8004' > END IF > LIMIT 0 , 10 > > And if not, would there be any query I could dynamically generate which > achieved the same result? > > Cheers, > Cam > > > -- С уважением, Соколов Евгений --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected] -~----------~----~----~----~------~----~------~--~---
