shan_cool Posted March 3, 2006 Share Posted March 3, 2006 Hi all, i hav an error in my subquerySELECT * 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 1how to make it? am using mysql 3.23Rgds,Shan Quote Link to comment Share on other sites More sharing options...
fenway Posted March 3, 2006 Share Posted March 3, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.