TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How to joins and count Left Date in SQL 2008
Pintoo Yadav
Jan 07
2015
Code
1.2
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
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