Jump to content

An interesting SQL Search problem


jonshutt

Recommended Posts

Hi folks. maybe experts here can help me out here...

 

I have 2 tables in a database, both store different information about a user.

 

eg:

table1 -> userid | name | address | phone

table2 -> userid | gender | age

 

(in fact, it's a bit more complicated than that, but that'll do for the example)

 

What I need to do is a search allong the lines of

 

SELECT * from `table1`, `table2`  where `table1.name` = 'jon' AND `table2.gender` = 'male'

 

 

However, it doesn't work, I'm getting an error like:  'Unknown column 'table1.name' in 'where clause'.

Any help appreciated.

 

If possible, it would be great to get this search query into 1 thing becuase the CMS i'm updating passes the results through an XML ajax thing, and can only display the results for one search query at a time...

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/167910-an-interesting-sql-search-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.