macromedia.coldfusion.database_access
[Top] [All Lists]

Re: How get record?.

Subject: Re: How get record?.
From: Ian Skinner <iskinner@xxxxxxxxxxx>
Date: Tue, 19 Feb 2008 12:14:46 -0800
Newsgroups: macromedia.coldfusion.database_access


Amm85 wrote:
This query bring all records in tbl_emp.
 How can i find records with tbl_emp.status = 'retired' only?.

 select tbl_emp.id,tbl_emp.name,tbl_emp.st_date,tbl_dept.deptname
 from tbl_emp left join tbl_dept
 on tbl_emp.id = tbl_dept
 where tbl_emp.status = 'retired'


Your join does not look complete.  It should be something like this.

FROM aTable LEFT JOIN bTable
ON aTable.foreignKey = bTable.keyField

You don't have a field. for the tbl_dept in the ON clause and I suspect you don't want to joing tbl_emp.id, but most likely some type of tbl_emp.deptID field.


<Prev in Thread] Current Thread [Next in Thread>