Sunday, 8 September 2013

Show two fields from two tables as one field in mysql LIKE

Show two fields from two tables as one field in mysql LIKE

I want to implement like search for autocomplete.I have two
tables,Location and SubLocation.
I want to return only one field for this like.Here is my query
SELECT l.loc_name,sl.sub_loc FROM Location l,SubLocation sl
where l.loc_name LIKE '$term%' OR sl.sub_loc='$term%'
I want to show matching result from both tables as one return.EG,if i type
D so i can view Dubai from first table and Marina from second table as one
coloumn

No comments:

Post a Comment