-3

Our requirement is making to search by name in three table which are

  1. product_phone
  2. product_tablet
  3. Product_accessories

First table containing columns(Id,model_name)

Second table containing columns(Id,model_name)

Third table containing columns(Id,model_name).

So my requirement is to search by magnified glass by model_name these three table without using join. I don't have any combination of each table.

devd196
  • 3
  • 6

1 Answers1

1

to be able to run a select query across multiple tables you just build a query that references all the tables .

select product_phone.name, product_tablet.name, product_accessories.name from product_phone, product_tablet, product_accessories

Be careful that your tables are not to big as to overwhelm your code with data , its a good idea to add a LIMIT clause to the end of your query to give you the specific number of results.

LIMIT clauses - http://www.w3schools.com/sql/sql_top.asp

As your id fields appear to be unrelated you should not attempt to use a join. If all the id's are unique then you could use a join , there a several different types of join but be careful with them as they can generate a lot of work for your database server.

joins - http://www.w3schools.com/sql/sql_join.asp

Amias
  • 335
  • 6
  • 16