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 |
mooppc
Starting Member
1 Post |
Posted - 2012-11-28 : 11:17:58
|
i need show datetime select only. But show all datetime in table filesTA.this code:SELECT *FROM filesTA tfWHERE EXISTS(SELECT *FROM filesTA tf left join LeaveRecord lr ON tf.ChkDate = lr.StartDate and tf.ChkDate = '2012-10-01'WHERE lr.StartDate = '2012-10-01') OR Code:SELECT *FROM filesTA tfWHERE NOT tf.EmpNo IN (SELECT lr.EmployeeRunFROM LeaveRecord lrWHERE lr.StartDate = '2012-10-01') Output:EmpNo | ChkDate | ChkIn | ChkOut00001 | 2012-10-01 00:00:00.000 | 2012-10-01 07:21:00.000 | 2012-10-01 12:21:00.00000002 | 2012-10-01 00:00:00.000 | 2012-10-01 08:13:00.000 | 2012-10-01 19:55:00.00000003 | 2012-10-15 00:00:00.000 | 2012-10-15 07:06:00.000 | 2012-10-15 20:12:00.00000004 | 2012-10-22 00:00:00.000 | 2012-10-22 07:12:00.000 | 2012-10-22 19:15:00.000I need Output:EmpNo | ChkDate | ChkIn | ChkOut00001 | 2012-10-01 00:00:00.000 | 2012-10-01 07:21:00.000 | 2012-10-01 12:21:00.00000002 | 2012-10-01 00:00:00.000 | 2012-10-01 08:13:00.000 | 2012-10-01 19:55:00.000THANKS FOR YOUR TIME. I'm beginnig ASP.NET. Nice to meet you. :) |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-11-28 : 11:34:55
|
SELECT tf.*FROM filesTA tf inner join LeaveRecord lr ON tf.ChkDate = lr.StartDate and tf.ChkDate = '20121001' Too old to Rock'n'Roll too young to die. |
|
|
|
|
|