Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   sql cross query (http://www.velocityreviews.com/forums/t955991-sql-cross-query.html)

SoniaArun 12-31-2012 08:28 AM

sql cross query
 
select a.ecode,b.empname,a.fromdate,a.[to],
case when c.leavedetails=1 or c.leavedetails=2 then
(select datediff(dd,a.fromdate,a.[to])-(datediff(wk,a.fromdate,a.[to])*2)-
case when datepart(dw,a.fromdate)=1 then 1 else 0 end +
case when datepart(dw,a.[to])=1 then 1 else 0 end +1)
else
datediff(dd,a.fromdate,a.[to])+1
end as days
,e.prjname,d.leavetype

from leavedetails a join empdata b on a.ecode=b.empcode
join leaverelation c on c.leavedetails=a.id
join leavetype d on c.leavetype=d.id
join project e on c.prjid=e.id


All times are GMT. The time now is 06:18 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.