sql - MySQL Statement Displaying Values Even If NULL -


i have 2 tables, employee & dependent. employee pk ssn , foreign key dependent table essn. trying retrieve name of employees , names of dependent. if employee not have dependent, need display blank value in dependent column.

to retrieve name of employees have dependents, statement use:

select        firstname "first name",        lastname "last name",       dependent_name "dependent name"  employee,dependent  ssn=essn; 

if guide me in right direction, appreciated.

use left join rows first table if there no matching in second:

select    firstname "first name",    lastname "last name",    dependent_name "dependent name"  employee left join dependent on dependent.essn = employee.ssn; 

i changed implicit old-style join ansi compliant explicit join too.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -