ecuevas
06-26-2007, 06:49 AM
How can I make a querie that finds the ten most expensive items in my table?:confused:
|
View Full Version : How Can I Do This ecuevas 06-26-2007, 06:49 AM How can I make a querie that finds the ten most expensive items in my table?:confused: chergh 06-26-2007, 06:53 AM SELECT TOP 10 field1, field2 FROM TableName ORDER BY PriceField DESC ecuevas 06-26-2007, 07:11 AM I don't really understand what you are trying to say. This is what I have so far: Field: Cost Table: TBL-Inventory Sort: Show: Checked Criteria: Or: What exactly would I type in? chergh 06-26-2007, 07:13 AM SELECT TOP 10 TBL-Inventory.cost FROM TBL-Inventory ORDER BY TBL-Inventory.cost DESC Your also going to want to include the field with the name of the item in this. ecuevas 06-26-2007, 07:28 AM It didn't work. I might have typed it into the wrong place. I put TOP 10 TBL-Inventory.Cost as the field. I also tried putting into Table but that didn't work either chergh 06-26-2007, 07:33 AM Right click on the title bar and select "SQL view" and then copy and paste the text. ecuevas 06-26-2007, 07:34 AM Should I put it at the end? chergh 06-26-2007, 07:38 AM No delete what is already there and replace it with what I have written ecuevas 06-26-2007, 07:44 AM It says "syntax error in FROM clause" when I try to close it. chergh 06-26-2007, 07:49 AM Try this: SELECT TOP 10 [TBL-Inventory].cost FROM [TBL-Inventory] ORDER BY [TBL-Inventory].cost DESC ecuevas 06-26-2007, 07:55 AM It works but now I can't see any of the other fields. chergh 06-26-2007, 07:56 AM Just go back to the design view and add the fields you need back in. ecuevas 06-26-2007, 08:13 AM It works now. Thanks for the help. Bratlien 06-26-2007, 08:49 AM Nice crash course in SQL. |