Jump to content

pbm wit simple sub query


shan_cool

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

Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.