Jump to content

Sub Queries In PHP


sandeepm

Recommended Posts

I am very new to this i have a doubt i am trying a query in php

 

the actual concept is

 

i have data of one user in users table

and the same users doing some transactions in transaction table

so i need to display the data from two different tables in single view file how can join both tables in single query

 

Note: users id is forgien key of transaction created_by

 

 

please suggest me

 

 

 

Link to comment
Share on other sites

If each row of one table corresponds to a row in the other table, then you can use a JOIN: http://www.w3schools.com/sql/sql_join_inner.asp

 

If both tables have the same kinds of fields and you just want rows from both tables then you can use the UNION operator in SQL: http://www.w3schools.com/sql/sql_union.asp

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...