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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tonelm54Author Commented:
Ive put a quick example on sqlfiddle at http://sqlfiddle.com/#!2/20bc9/1 in the hope someone with more experience can help.
I suspect you just need to use "join conditions"

FROM `paras`

LEFT JOIN `call` ON `paras`.`paraName` = `call`.`assignedTo`
	AND `timeClear` IS NULL
	OR `timeClear` = '0000-00-00 00:00:00'

ORDER BY `paras`.`paraName` ASC

Open in new window

but in trying to use that sqlfiddle I get this error message:
Cannot convert value '0000-00-00 00:00:00' from column 8 to TIMESTAMP.: SELECT `paras`.`paraName` ,`call`.* FROM `paras` LEFT JOIN `call` ON `paras`.`paraName` = `call`.`assignedTo` AND `timeClear` IS NULL OR `timeClear` = '0000-00-00 00:00:00' ORDER BY `paras`.`paraName` ASC

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SELECT	`paras`.`paraName`
,	`call`.`priID`
FROM	`paras`
JOIN	`call`			ON	`paras`.`paraName` = `call`.`assignedTo`
				AND	(	`timeClear` IS NULL
					OR	`timeClear` = 0
BY	`paras`.`paraName` ASC

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.