Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Post
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
6
Reply
selecting top record in a query.
Turkalp Kucur
11 years ago
3.2k
Reply
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.
Post
Reset
Cancel
Answers (
6
)
Next Recommended Forum
How To Get Constarint using select query
When will use select hint in sql server? why they use?