Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
02119
Starting Member
8 Posts |
Posted - 2013-01-29 : 11:20:07
|
here is my codeselect *from dbo.vw_ComplyWise_Last_ERDjoin (select EMPLOYEE_ID,MAX(DATE_OBTAINED)As Date_Obtainedfrom dbo.vw_ComplyWise_Last_ERDgroup by EMPLOYEE_ID)using (EMPLOYEE_ID,DATE_OBTAINED)but i get the following errorMsg 102, Level 15, State 1, Line 6Incorrect syntax near ')'.I'm trying to only return the last record based on the date obtained for each employeeThanks i advanceSteve |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2013-01-29 : 11:27:16
|
select *from dbo.vw_ComplyWise_Last_ERDjoin (select EMPLOYEE_ID,MAX(DATE_OBTAINED)As Date_Obtainedfrom dbo.vw_ComplyWise_Last_ERDgroup by EMPLOYEE_ID)using (EMPLOYEE_ID,DATE_OBTAINED)what is that? that's not valid SQL Server syntaxand you should specify what you're joining on. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-01-29 : 11:34:26
|
[code]select t.*from dbo.vw_ComplyWise_Last_ERD tjoin (select EMPLOYEE_ID,MAX(DATE_OBTAINED)As Date_Obtainedfrom dbo.vw_ComplyWise_Last_ERDgroup by EMPLOYEE_ID)mON m.EMPLOYEE_ID = t.EMPLOYEE_ID AND m.DATE_OBTAINED = t.DATE_OBTAINED [/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
02119
Starting Member
8 Posts |
Posted - 2013-01-29 : 11:53:22
|
Thanks that worked perfectly. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-01-29 : 12:48:56
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|