Click here to Skip to main content
14,297,561 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi,
I want to know the query in searching multiple tables in db? I used MySQL database.

Example I have two tables named table1 and table2. If I search some name in table1 if results not found then search in the other table table2. Is this possible?

table: table1
Lname (pk)
Fname
TableNo

table: table2
Lname (pk)
Fname
TableNo

thank you...
Posted
Updated 29-Jul-12 16:39pm
v3

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

I suggest reading some online articles about how SQL works, this is basic stuff.

You use the inner join keywords to join two tables together, you will need a value that is shared between the two. Then you can search for data between tables, but only if they are related to one another.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100