Jump to content

Archived

This topic is now archived and is closed to further replies.

shan_cool

pbm wit simple sub query

Recommended Posts

Hi all,
i hav an error in my subquery


SELECT * FROM HR_Emp_Det WHERE Emp_LName=(select Emp_LName FROM `HR_Emp_Det` WHERE Emp_Id='368')


it shows me,
You have an error in your SQL syntax near 'select Emp_LName FROM `HR_Emp_Det` WHERE Emp_Id='368') LIMIT 0, 30' at line 1


how to make it? am using mysql 3.23

Rgds,
Shan

Share this post


Link to post
Share on other sites
No subqueries in 3.23 -- rewrite it as a JOIN (UNTESTED):

[code]SELECT h1.* FROM HR_Emp_Det AS h1, HR_Emp_Det AS h2 WHERE h1.Emp_LName = h2.Emp_LName AND =h2.Emp_Id='368'[/code]

I'm assuming here that you have an index on Emp_LName. BTW, I don't know where your LIMIT clause came from.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.