Jump to content

find data from another table


adv

Recommended Posts

They're just shorthand table aliases, so you say I want to reference table as t by "SELECT field FROM table t"

 

 

and the t. and d. are specifying which table the field belongs to, you need to do this when you make a mysql join because say if table1 has a field named id, and table2 also has a field named id, and I select id in a query where I join the result set from each table, it doesn't know which table's id field I want to select.

 

 

You could write that query like,

 

 

SELECT table.fullname FROM table
   INNER JOIN data ON ( table.full_name = data.client_name )
   WHERE table.type = '$type'

 

 

Thats saying

SELECT {the fullname field from the table "table"
   INNER JOIN {the data table} IF {full_name from table "table" is equal to client_name from table "data"}
   WHERE {type field from table "table" is equal to $type

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.