C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to joins and count Left Date in SQL 2008
WhatsApp
Pintoo Yadav
Jan 07
2015
1.3
k
0
0
select
*
from
(
select
*
FROM
(
select
customer_mst.CUST_ID,customer_mst.firstname,
boxdetail_mst.boxnumber,customer_mst.address,customer_mst.city,customer_mst.groups,
customer_mst.mobile,paymentlist_mst.amount
as
dueamount,
case
when
datediff(dd,getdate(),due_date) = 0
then
1
else
datediff(dd,getdate(),due_date)
end
days_left,
ROW_NUMBER() OVER(
ORDER
BY
firstname
desc
)
as
RowNum
from
customer_mst
inner
join
paymentlist_mst
on
customer_mst.CUST_ID= paymentlist_mst.CUST_ID
left
join
boxdetail_mst
on
customer_mst.CUST_ID= boxdetail_mst.CUST_ID
where
is_active =
'Y'
and
convert
(
date
,due_date,103) >=
convert
(
date
,getdate(),103)) a
WHERE
RowNum
BETWEEN
1
AND
(1 + 25) - 1 ) b
where
cust_id = 2
order
by
firstname
desc
SQL
join
count left date in SQL