mysql - SQL values from two different tables -
okay have 2 tables in 1 database. 1 called accounts
, 1 called settings
. through one query fetch settings.positionx
, settings.positiony
, accounts.lastlogin
. how go doing this?
without knowing conditions want can guess.. here need do.
if want records match in accounts , settings then:
select settings.positionx, settings.positiony, accounts.lastlogin settings inner join accounts on settings.condition = accounts.condition
if want records accounts (or settings) join matching records want left join
/ right join
select settings.positionx, settings.positiony, accounts.lastlogin settings left join accounts on settings.condition = accounts.condition
you can see visual representation of these joins here
Comments
Post a Comment