Click here to Skip to main content
15,919,479 members
Home / Discussions / Database
   

Database

 
AnswerRe: Syntax error converting datetime from character string..., Pin
Krish - KP3-Aug-07 1:37
Krish - KP3-Aug-07 1:37 
GeneralRe: Syntax error converting datetime from character string..., Pin
Member 38798813-Aug-07 1:42
Member 38798813-Aug-07 1:42 
GeneralRe: Syntax error converting datetime from character string..., Pin
Member 38798813-Aug-07 1:44
Member 38798813-Aug-07 1:44 
GeneralRe: Syntax error converting datetime from character string..., Pin
gauthee3-Aug-07 2:27
gauthee3-Aug-07 2:27 
QuestionDataBinding, the correct order to Fill, update and delete Pin
steve_rm3-Aug-07 0:50
steve_rm3-Aug-07 0:50 
QuestionQuery probs..., Pin
Member 38798812-Aug-07 21:24
Member 38798812-Aug-07 21:24 
AnswerRe: Query probs..., Pin
Pete O'Hanlon3-Aug-07 0:54
mvePete O'Hanlon3-Aug-07 0:54 
AnswerRe: Query probs... Effective Salary Date Pin
andyharman3-Aug-07 1:47
professionalandyharman3-Aug-07 1:47 
Hi Magi

Try:
SELECT EM.EmpId, TC.CardDate, SD.Whrs,
  MHD.Appwhours as AppHours, MHD.AppOtHours as AppOtHours 
FROM dbo.tblEmployeeMaster EM
INNER JOIN dbo.tblTimeCardmain TC 
  ON EM.EmpId = TC.EmpId
INNER JOIN dbo.tblSalaryDetails SD 
  ON EM.EmpId= SD.EmpId
  AND SD.EffectiveDate = (
                  SELECT Min(A.EffectiveDate)
                  FROM dbo.tblSalaryDetails A
                  WHERE A.EmpId = EM.EmpId
                  AND A.EffectiveDate <= TC.CardDate)
LEFT OUTER JOIN dbo.tblMonthHourdetails MHD 
  ON TC.EmpId = MHD.EmpId
  AND TC.CardDate = MHD.Sdate 
WHERE TC.CardDate = '8/1/2007'
AND TC.app1 = 1
AND TC.projectid = 100
ORDER BY EM.EmpId
It uses a correlated sub-query to find the effective salary record (assuming your date column is named "EffectiveDate").

Regards
Andy

If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message".

QuestionRegarding Sql server Pin
Praveen0292-Aug-07 20:44
Praveen0292-Aug-07 20:44 
AnswerRe: Regarding Sql server Pin
Blue_Boy2-Aug-07 21:20
Blue_Boy2-Aug-07 21:20 
QuestionRe: Regarding Sql server Pin
Praveen0293-Aug-07 1:00
Praveen0293-Aug-07 1:00 
AnswerRe: Regarding Sql server [modified] Pin
Blue_Boy3-Aug-07 4:42
Blue_Boy3-Aug-07 4:42 
QuestionSelecting data between twodates?? Pin
Ron.S2-Aug-07 20:27
Ron.S2-Aug-07 20:27 
AnswerRe: Selecting data between twodates?? Pin
Blue_Boy2-Aug-07 21:18
Blue_Boy2-Aug-07 21:18 
QuestionHow to find duplicate record Pin
yogesh_kumar_agarwal2-Aug-07 18:17
yogesh_kumar_agarwal2-Aug-07 18:17 
AnswerRe: How to find duplicate record Pin
Blue_Boy2-Aug-07 21:25
Blue_Boy2-Aug-07 21:25 
QuestionOracle MetaData Dependency Pin
manish242-Aug-07 17:45
manish242-Aug-07 17:45 
QuestionThe last piece of a puzzle Pin
Sunset Towers2-Aug-07 12:36
Sunset Towers2-Aug-07 12:36 
AnswerRe: The last piece of a puzzle Pin
Christian Graus2-Aug-07 12:51
protectorChristian Graus2-Aug-07 12:51 
QuestionImporting a Tab delimited report file Pin
Jack Fleet2-Aug-07 9:23
Jack Fleet2-Aug-07 9:23 
AnswerRe: Importing a Tab delimited report file Pin
leckey2-Aug-07 9:42
leckey2-Aug-07 9:42 
GeneralRe: Importing a Tab delimited report file Pin
Jack Fleet2-Aug-07 9:52
Jack Fleet2-Aug-07 9:52 
GeneralRe: Importing a Tab delimited report file Pin
pmarfleet2-Aug-07 12:39
pmarfleet2-Aug-07 12:39 
GeneralRe: Importing a Tab delimited report file Pin
Jack Fleet3-Aug-07 12:26
Jack Fleet3-Aug-07 12:26 
QuestionMySQL/ODBC Table will not Update from DataGrid [modified] Pin
][cecu3e2-Aug-07 6:52
][cecu3e2-Aug-07 6:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.