shan_cool Posted December 26, 2005 Share Posted December 26, 2005 hi all my sub query is: select Max(m.Start_Date) from HR_Emp_Det e, skill_master i, tdm_proposal p,tdm_prj_mem_det m where e.Emp_Id=i.Emp_Id and i.Emp_Id=m.Emp_Id and p.Prj_Code=m.Prj_Code and e.Emp_Status <> 'R' and m.Emp_Id='20' group by m.Emp_Id This give me correct output.. this output is passed to the where condition of main query. my main query is: select e.Emp_Id,e.Emp_FName, e.Emp_LName,e.Emp_Ug_Deg, e.PG_Deg,e.Emp_Desgn, e.Emp_DOJ,e.Base_Location, e.Emp_Ug_Year,e.PG_Year, i.Emp_Id,i.Test_Exp,i.Dev_Exp, i.Other_Exp,p.Prj_Code, p.Project_Name,p.Client, p.Location,m.Prj_Code, m.Emp_Id,Max(m.Start_Date) , IF(m.End_Date="",m.End_Date, Max(m.End_Date)),m.cty from HR_Emp_Det e, skill_master i, tdm_proposal p,tdm_prj_mem_det m where e.Emp_Id=i.Emp_Id and i.Emp_Id=m.Emp_Id and p.Prj_Code=m.Prj_Code and e.Emp_Status <> 'R' and m.Emp_Id='20' and m.Start_Date='2003-02-01' group by m.Emp_Id here i hav hard coded the date in where condition... it works fine.. but i need to merge both queries as: select e.Emp_Id,e.Emp_FName, e.Emp_LName,e.Emp_Ug_Deg, e.PG_Deg,e.Emp_Desgn, e.Emp_DOJ,e.Base_Location, e.Emp_Ug_Year,e.PG_Year, i.Emp_Id,i.Test_Exp,i.Dev_Exp, i.Other_Exp,p.Prj_Code, p.Project_Name,p.Client, p.Location,m.Prj_Code, m.Emp_Id,Max(m.Start_Date) , IF(m.End_Date="",m.End_Date, Max(m.End_Date)),m.cty from HR_Emp_Det e, skill_master i, tdm_proposal p,tdm_prj_mem_det m where e.Emp_Id=i.Emp_Id and i.Emp_Id=m.Emp_Id and p.Prj_Code=m.Prj_Code and e.Emp_Status <> 'R' and m.Emp_Id='20' and m.Start_Date="select Max(m.Start_Date) from HR_Emp_Det e, skill_master i, tdm_proposal p,tdm_prj_mem_det m where e.Emp_Id=i.Emp_Id and i.Emp_Id=m.Emp_Id and p.Prj_Code=m.Prj_Code and e.Emp_Status <> 'R' and m.Emp_Id='20' group by m.Emp_Id " group by m.Emp_Id this doesn't work gimme some idea how to implement this.. rgds, shan India... Quote Link to comment Share on other sites More sharing options...
fenway Posted December 26, 2005 Share Posted December 26, 2005 As indicated in the replies to your other [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=81826\" target=\"_blank\"]thread[/a] on the same topic, your MySQL version doesn't support this; furthermore, the correct way to use a subquery is to enclose the inner query in parentheses, not double quotes. Quote Link to comment Share on other sites More sharing options...
shan_cool Posted December 27, 2005 Author Share Posted December 27, 2005 hi , thank u verymuch for ur reply.................. i used parenthesis... but still query is being executed successfully but no records r displayed. may b the pbm wit mysql version as u said.... rgds, shan, India... 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.