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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query

Author  Topic 

immad
Posting Yak Master

230 Posts

Posted - 2013-05-29 : 06:25:25

what is the meaning in RED

select
a.CID,
a.BID,
a.Eid,
a.checktime as itime,
a.AttendID IAttendID,
min(b.checktime) as otime,
b.AttendID OAttendID,
a.Remarks,
a.Comments,
a.InBetween
from
FE11 (@CID,@BID,@EmpID,@FromDate,@ToDate,@Dept)
as a
left outer join FE11 (@CID,@BID,@EmpID,@FromDate,@ToDate,@Dept) as b
on b.Eid=a.Eid
and b.checktime>a.checktime
and b.Status='O'
and a.bid = b.bid
AND convert (VARCHAR(10),a.CHECKTIME,120) = convert (VARCHAR(10),b.CHECKTIME,120)
where a.Status='I'
group by
a.CID,
a.BID,
a.Eid,
a.AttendID,
b.AttendID,
a.checktime,
a.Remarks,
a.Comments,
a.InBetween
) as a
left outer join FE11 (@CID,@BID,@EmpID,@FromDate,@ToDate,@Dept) as b
on b.Eid=a.Eid
and b.checktime>a.otime
and b.Status='I'
and a.bid = b.bid
AND convert (VARCHAR(10),b.CHECKTIME,120) = convert (VARCHAR(10),a.ITIME,120)
group by
a.CID,
a.BID,
a.Eid,
IAttendID,
OAttendID,
otime,
a.Remarks,
a.Comments,
a.InBetween
) as a

left outer join FE11 (@CID,@BID,@EmpID,@FromDate,@ToDate,@Dept) as b
on b.Eid=a.Eid
AND convert (VARCHAR(10),a.ITime,120) = convert (VARCHAR(10),b.CheckTime,120)
and b.checktime < isnull(a.itime2,'21991231')

immad uddin ahmed

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2013-05-29 : 06:38:50
Thats is a date parameter

select cast('21991231' as date)

Senthil Kumar C
------------------------------------------------------
MCITP - Database Administration SQL SERVER 2008
MCTS - Database Development SQL SERVER 2008
Go to Top of Page

immad
Posting Yak Master

230 Posts

Posted - 2013-05-29 : 06:41:34
'21991231' what type of date is this please explain me why its use

immad uddin ahmed
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2013-05-29 : 06:54:39
This is string compatibale to convert into ISO date Format

Senthil Kumar C
------------------------------------------------------
MCITP - Database Administration SQL SERVER 2008
MCTS - Database Development SQL SERVER 2008
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-05-29 : 06:57:30
quote:
Originally posted by immad

'21991231' what type of date is this please explain me why its use

immad uddin ahmed


its just a very large date value used as default value in this case for itime2 field to deal with NULL values. I think its used as condition to check is > which makes it a trivial check (always true) in case time2 is NULL

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

immad
Posting Yak Master

230 Posts

Posted - 2013-05-29 : 07:08:34
'21991231' can u tell me why its use please explain me we r making attendance project and my senior developer make this query

immad uddin ahmed
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-05-29 : 07:19:35
quote:
Originally posted by immad

'21991231' can u tell me why its use please explain me we r making attendance project and my senior developer make this query

immad uddin ahmed


Read my previous post and let me know what you didnt understand in it

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

immad
Posting Yak Master

230 Posts

Posted - 2013-05-29 : 07:27:06
Got it

immad uddin ahmed
Go to Top of Page
   

- Advertisement -