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
Sai Reddy
NA
214
30.9k
Above and below values of a id
Feb 11 2019 11:48 PM
Hi ,Please help me to solve it.
create table sample
(
ID int IDENTITY,
country varchar(10),
UNI int,
)
insert into sample values('INDIA',1000),('INDIA',1001),('INDIA',1002),('INDIA',1003),('INDIA',1004),('INDIA',1005),
('AUS',1001),('AUS',1002),('AUS',1003),('AUS',1004),('AUS',1005),('US',1001),('US',1002),('US',1003),('US',1004);
select * from sample;
When i pass the particular id from one group of countr i need the 2 above and 2 below of passed number from the same country.
Ex: if i pass the id=9 then result should be as follows
7
AUS
1001
8
AUS
1002
9
AUS
1003
10
AUS
1004
11
AUS
1005
Reply
Answers (
4
)
Fetch only not null columns from a table.
Job Scehdule in Sql server usinh Sql Server Agent