Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
6
Reply
selecting top record in a query.
Turkalp Kucur
Nov 13 2012 3:01 PM
3.1k
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.
Upload Source Code
Select only zip and rar file.
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?