Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TOP, not returning what I want

Status
Not open for further replies.

OAKEJ

Programmer
Apr 13, 2005
39
US
I want to use the Top 10 to scan the table and show me the top 10 costs by site, the way the query is now, it just returns the top 10 of all sites. Any suggestions

----------------------CODE---------------------------------
use BI_db
GO

SELECT OBSITE as Site TOP 10 ,OBREPR as Repair Order,SUM(OOTOTA) AS Sublet Cost

FROM DBO.FLOB INNER JOIN
DBO.FLOO ON DBO.FLOB.OBREPR=DBO.FLOO.OOREPR

WHERE OBCUST=' ' AND OBBKYR=2008

GROUP BY OBSITE,OBREPR

ORDER BY SUBLETCOST DESC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top