[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

PHP/MYSQL - query 2 table columns with single search string

Hi,

My sql table consists of the following columns: house_number (int) and address (text). How can I query the table with a single search string e.g. "13 AnyStreet"? I suspect I should be using the explode function but I'm unsure how to go about it.

Thanks in advance    
0
sgoldblatt
Asked:
sgoldblatt
  • 2
1 Solution
 
almilyoCommented:
select * from table where concat(house_number,' ',AnyStreet)='12 AnyStreet'
0
 
almilyoCommented:
I should point out that I wouldn't be too happy if I saw someone doing this - concatenating fields in this way won't be  particularly fast. If you give me some more info on the context maybe they'll be a better way to do this?
0
 
sgoldblattAuthor Commented:
Yes, that works. Many thanks
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now