Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql select condition with left join

SELECT 
  person.name, job.name, job.status 'I want all people and display a job if it is current and not past'
FROM 
  person
LEFT JOIN 
   job ON person.id=job.personId AND job.status = 'current';
   
   'Will Display this'
   
Bob : Plumber : current
Jane : Driver : current
Mike : Cook : current
John : :  
Mary : : 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sql #select #condition #left #join
ADD COMMENT
Topic
Name
8+9 =