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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rohatash Kumar
Tech Writer
23.6k
34.8m
Comparing Data in Two Consecutive Rows in SQL
Oct 4 2012 5:26 AM
Hi all,
Suppose my database table is looks like below table,
Id Date1 Name Type
1 2012-07-16 00:00:00.000 Rohit A
1 2012-07-16 00:00:00.000 Rohit A
1 2012-07-16 06:00:00.000 Rohit B
2 2012-07-16 08:00:00.000 Rahul A
2 2012-07-16 20:00:00.000 Rahul B
2 2012-07-16 21:00:00.000 Rahul B
In the above table, Two consecutive rows have the same name A then only last row should be display in the output table. AND I want a output like that:
Id Date1 Name Type
1 2012-07-16 00:00:00.000 Rohit A
1 2012-07-16 06:00:00.000 Rohit B
2 2012-07-16 08:00:00.000 Rahul A
2 2012-07-16 21:00:00.000 Rahul B
How can I do this? Please help me.
Rohatash
Reply
Answers (
4
)
How to use like operator in where condition ?
what is @@Rowcount in sqlserver2005