sql cross query

Discussion in '.NET' started by SoniaArun, Dec 31, 2012.

  1. SoniaArun

    SoniaArun

    Joined:
    Dec 18, 2012
    Messages:
    2
    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
    SoniaArun, Dec 31, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dmluZWV0YmF0dGE=?=

    Cross- Side Scripting and SQL data reader

    =?Utf-8?B?dmluZWV0YmF0dGE=?=, May 11, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    378
    =?Utf-8?B?dmluZWV0YmF0dGE=?=
    May 11, 2004
  2. EDom

    Problems in Cross Tab Query

    EDom, Jul 23, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    457
    jasonkester
    Jul 23, 2005
  3. Edward
    Replies:
    4
    Views:
    4,584
    William \(Bill\) Vaughn
    Apr 10, 2006
  4. Anonymous
    Replies:
    0
    Views:
    1,439
    Anonymous
    Oct 13, 2005
  5. ecoolone
    Replies:
    0
    Views:
    742
    ecoolone
    Jan 3, 2008
Loading...

Share This Page