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
Abhimanyu K Vatsa
NA
40.4k
21.4m
Using two different tables in query
Apr 28 2011 11:25 AM
In my ASP.NET application, I am wishing to select top 20 records (10 and 10) from two different tables named 'PostedByAdmins' and 'PostedByGuest'. I have used following queries but no use:-
SELECT TOP 20 [title], [source], [description] FROM [
PostedByAdmins
,
PostedByGuest
] ORDER BY [id] DESC
SELECT TOP 20 [title], [source], [description] FROM [
PostedByAdmins
], [
PostedByGuest
] ORDER BY [id] DESC
Even I tried to delete TOP 20 even I don't wish this but no use like
SELECT [title], [source], [description] FROM [
PostedByAdmins
], [
PostedByGuest
] ORDER BY [id] DESC
I tried to delete TOP 20 and ORDER by but no use as
SELECT [title], [source], [description] FROM [
PostedByAdmins
], [
PostedByGuest
]
For the demonstration purpose I check both table one by one and this worked fine
SELECT TOP 20 [title], [source], [description] FROM [
PostedByAdmins
] ORDER BY [id] DESC
SELECT TOP 20 [title], [source], [description] FROM [
PostedByGuest
] ORDER BY [id] DESC
So, there is no problem with development of tables or say in other coding except query.
So, guys what query I use to fix my issue. Remeber I need top 10 records from both tables.
Thanks in advance.
Reply
Answers (
1
)
How to solve the problem of concurrency in ADO.NET ?
Detach mdf file on form closing