Hi,
The below query works well for returning 1 result however I now need to expand it to return multiple results. At the moment I feed it 1 car type and 1 company id and it spits out one result, I then loop the query to get the number of results I need - but this is very inefficiant so I want to change it so I pass all my variables at once.
So where I have cars.type ='1' I want to have car.type ='1' or cars.type='2' which in itself works but how to I extend the company section as when I add the extra 'Or's' in there the query goes wacky and spits out hundreds of results which are all the same - I think its something to do with the inner join but im not sure.
Code MySQL:SELECT prices.single_f, prices.return_f, prices.vehicle, resort.company_id, resort.resort, cars.type, cars.description, cars.long_description, cars.image, surcharges.type, surcharges.adult, surcharges.kids, prices.timefrom, prices.timeto, prices.resort_id, cars.min, cars.max, company.is_enabled FROM prices INNER JOIN resort ON resort.id = prices.resort_id AND resort.company_id = '1' AND resort.resort = 'Acoteias' INNER JOIN company ON company.id = '1' INNER JOIN cars ON cars.type = prices.vehicle AND cars.type = '2' LEFT JOIN surcharges ON surcharges.resort_id = prices.resort_id WHERE prices.break <= '102' AND company.is_enabled = 'Yes' AND ( ( prices.timefrom <= prices.timeto AND prices.timefrom <= '05:00:00' AND prices.timeto >= '05:00:00' ) OR ( prices.timefrom >= prices.timeto AND prices.timefrom <= '05:00:00' AND '23:59:59' >= '05:00:00' ) OR ( prices.timefrom >= prices.timeto AND '00:00:00' <= '05:00:00' AND prices.timeto >= '05:00:00' ) ) LIMIT 0 , 30
Thanks
Chris









Bookmarks