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
mohit ranjan
NA
51
0
condition in union all
Jan 28 2013 5:55 AM
i have to extract 15 record i want my query like this
declare @maxcount int=15
SELECT TOP (@maxcount ) * FROM PG_table1 WITH (NOLOCK)
WHERE ISNULL(BatchId,0) != 0 AND [Status] = 7
and WebsiteId in (136)
(but if this query return 10 rows then below return 5 row)
union all
SELECT TOP (@maxcount-no. of row extracted from above query) * FROM PG_table1 WITH (NOLOCK)
WHERE ISNULL(BatchId,0) != 0 AND [Status] =7
and WebsiteId in (138)
Reply
Answers (
1
)
in store procedure how to use insert,delete,update,
Get backup of remote sql server database