mysql - SQL Query, how to get all elements from one list and only the similar ones from another table -


i have 2 tables, , have partids similarity branch them. need pull 3 columns first table , 2 columns table 2.

the problem having table 1 has more or different partids table 2 , ok. in third table want able have query can run , give me partids first table , second table if dont exist in other one. if exist in both data

this code shows partids similar between both tables:

select `sheet1$`.enspieceid, `sheet1$`.`part number`, `sheet1$`.description,`sheet1$`.titretype, `sheet1$`.utilization, `sheet2$`.notes, `sheet2$`.justification `sheet1$` `sheet1$`, `sheet2$` `sheet2$` `sheet1$`.enspieceid = `sheet2$`.enspieceid 

i need can flag partids coming 1st sheet , 2nd sheet.

select `sheet1$`.enspieceid, `sheet1$`.`part number`, `sheet1$`.description,`sheet1$`.titretype, `sheet1$`.utilization, `sheet2$`.notes, `sheet2$`.justification `sheet1$` `sheet1$` left join `sheet2$` `sheet2$` on `sheet1$`.enspieceid = `sheet2$`.enspieceid 

would return records sheet1 , in sheet 2 match; assuming there no other syntax errors.


Comments

Popular posts from this blog

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -