Pass by reference?

I am trying to select similar data from three different tables.

example: Select * from customer_products where customer = xcustomer
Select * from customer_sales where customer = xcustomer
Select * from accounts where customer = xcustomer

How can I pass the table to query in variable

something like : Select * from $var where customer = xcustomer

Where $var = customer_products , customer_sales or accounts

You would use a JOIN query if the data you are selecting is related to, dependent upon, each other. You would use a UNION query if the things you are selecting have the same meaning between the tables. e.g. quantities, amounts, … If the data you are selecting isn’t related or with the same meaning, you would execute each query separately.

Sponsor our Newsletter | Privacy Policy | Terms of Service