Returning Top Ten in Report

J

joshroberts

I have a report based on a query of defects by part types. I would like to
limit the report to the top ten defective parts. Can you help me with this?
Thanks.
 
O

Ofer Cohen

In the report control source define the amount of line you want to be
displayed in the report using TOP

Select TOP 10 TableName.* From TableName Order By [FieldName]

The order by need to be on the field that indicate which are the top parts
==============================
If you want the Top 10 parts for each group of parts (part type), use
something like

Select T1.* TableName As T1 Where T1.[PartNumber] In (Select Top 10
T2.[PartNumber] From TableName As T2 Where T2.[PartType] = T1.[PartType]
Order By [FieldName])

If you need help with the SQL, please provide me with the TableName,
PartNumber field name, group of part field name, the field to create the
order by name
 
J

joshroberts

I understand the SQL stuff okay however I can't find the report control
source or at least I don't know what I'm looking at. Thanks for the help.

Ofer Cohen said:
In the report control source define the amount of line you want to be
displayed in the report using TOP

Select TOP 10 TableName.* From TableName Order By [FieldName]

The order by need to be on the field that indicate which are the top parts
==============================
If you want the Top 10 parts for each group of parts (part type), use
something like

Select T1.* TableName As T1 Where T1.[PartNumber] In (Select Top 10
T2.[PartNumber] From TableName As T2 Where T2.[PartType] = T1.[PartType]
Order By [FieldName])

If you need help with the SQL, please provide me with the TableName,
PartNumber field name, group of part field name, the field to create the
order by name
--
Good Luck
BS"D


joshroberts said:
I have a report based on a query of defects by part types. I would like to
limit the report to the top ten defective parts. Can you help me with this?
Thanks.
 
O

Ofer Cohen

Sorry, my mistake, it should be the Record Source of the report and not the
control source

--
Good Luck
BS"D


joshroberts said:
I understand the SQL stuff okay however I can't find the report control
source or at least I don't know what I'm looking at. Thanks for the help.

Ofer Cohen said:
In the report control source define the amount of line you want to be
displayed in the report using TOP

Select TOP 10 TableName.* From TableName Order By [FieldName]

The order by need to be on the field that indicate which are the top parts
==============================
If you want the Top 10 parts for each group of parts (part type), use
something like

Select T1.* TableName As T1 Where T1.[PartNumber] In (Select Top 10
T2.[PartNumber] From TableName As T2 Where T2.[PartType] = T1.[PartType]
Order By [FieldName])

If you need help with the SQL, please provide me with the TableName,
PartNumber field name, group of part field name, the field to create the
order by name
--
Good Luck
BS"D


joshroberts said:
I have a report based on a query of defects by part types. I would like to
limit the report to the top ten defective parts. Can you help me with this?
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top