Link to home
Start Free TrialLog in
Avatar of tonelm54
tonelm54

asked on

Left join from SQL

Ive got an SQL query which is working great:-
SELECT `paras`.`paraName`, `call`.`priID`
FROM `paras`
LEFT JOIN `call`
ON `paras`.`paraName` = `call`.`assignedTo`
ORDER BY `paras`.`paraName` ASC

Open in new window


Problem is I now only want it to look only in `call` where `cleared`=null or 0000-00-00 00:00:00, so something like:-
SELECT (SELECT * FROM `call` WHERE `timeClear` IS NULL or `timeClear` = '0000-00-00 00:00:00'; ) AS `paraName`, `call`.`priID`
FROM `paras`
LEFT JOIN `call`
ON `paras`.`paraName` = `call`.`assignedTo`
ORDER BY `paras`.`paraName` ASC

Open in new window


So need to do a subquery and pull the LEFT JOIN.

Im a little confused how I can do this, does anyone have any ideas or pointers?

Thank you
Avatar of tonelm54
tonelm54

ASKER

Ive put a quick example on sqlfiddle at http://sqlfiddle.com/#!2/20bc9/1 in the hope someone with more experience can help.
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial