Joining Columns in Mysql Query
Posted: Fri Jun 19, 2009 7:56 am
Hi
Does anyone know how I can query 2 fields in a mysql database as one?
for example there is 8 fields in a rental database and 2 of them are fields price_short, price_long this is where customers can add whether they offer longterm or short term rentals, so some may just add price in longterm and some in just shortterm.
How can I query both these fields at once and display which ever one has a value in it?
I have tried something like this but it dont work
Does anyone know how I can query 2 fields in a mysql database as one?
for example there is 8 fields in a rental database and 2 of them are fields price_short, price_long this is where customers can add whether they offer longterm or short term rentals, so some may just add price in longterm and some in just shortterm.
How can I query both these fields at once and display which ever one has a value in it?
I have tried something like this but it dont work
Code: Select all
SELECT * FROM $table (SELECT price_short,price_long) AS price WHERE price =300