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
Turkalp Kucur
NA
50
19.1k
selecting top record in a query.
Nov 13 2012 3:01 PM
Hello there.
I am working on northwind database.
There are nine employees in the database.
Each employee has his&her sales.
My aim is to return the top most of the sales they have done. so there will be nine results.
below script returns all the sales they did, which I could not return the top most sales.
select e.firstname+' '+e.lastname as [Worker], p.productname as [Top most saled product], r.quantity*r.unitprice as [Price] from employees as e
inner join orders as o on e.employeeid=o.employeeid
inner join [order details] as r on r.orderid=o.orderid
inner join products as p on p.productid= r.productid
where o.shippeddate is null order by [Price] desc
go
help please.
Reply
Answers (
6
)
How To Get Constarint using select query
When will use select hint in sql server? why they use?