E ecuevas Registered User. Local time Today, 04:11 Joined Jun 18, 2007 Messages 74 Jun 26, 2007 #1 How can I make a querie that finds the ten most expensive items in my table?
chergh blah Local time Today, 10:11 Joined Jun 15, 2004 Messages 1,414 Jun 26, 2007 #2 SELECT TOP 10 field1, field2 FROM TableName ORDER BY PriceField DESC
E ecuevas Registered User. Local time Today, 04:11 Joined Jun 18, 2007 Messages 74 Jun 26, 2007 #3 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?
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 blah Local time Today, 10:11 Joined Jun 15, 2004 Messages 1,414 Jun 26, 2007 #4 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.
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.
E ecuevas Registered User. Local time Today, 04:11 Joined Jun 18, 2007 Messages 74 Jun 26, 2007 #5 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
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 blah Local time Today, 10:11 Joined Jun 15, 2004 Messages 1,414 Jun 26, 2007 #6 Right click on the title bar and select "SQL view" and then copy and paste the text.
E ecuevas Registered User. Local time Today, 04:11 Joined Jun 18, 2007 Messages 74 Jun 26, 2007 #7 Should I put it at the end?
chergh blah Local time Today, 10:11 Joined Jun 15, 2004 Messages 1,414 Jun 26, 2007 #8 No delete what is already there and replace it with what I have written
E ecuevas Registered User. Local time Today, 04:11 Joined Jun 18, 2007 Messages 74 Jun 26, 2007 #9 It says "syntax error in FROM clause" when I try to close it.
chergh blah Local time Today, 10:11 Joined Jun 15, 2004 Messages 1,414 Jun 26, 2007 #10 Try this: SELECT TOP 10 [TBL-Inventory].cost FROM [TBL-Inventory] ORDER BY [TBL-Inventory].cost DESC
E ecuevas Registered User. Local time Today, 04:11 Joined Jun 18, 2007 Messages 74 Jun 26, 2007 #11 It works but now I can't see any of the other fields.
chergh blah Local time Today, 10:11 Joined Jun 15, 2004 Messages 1,414 Jun 26, 2007 #12 Just go back to the design view and add the fields you need back in.
E ecuevas Registered User. Local time Today, 04:11 Joined Jun 18, 2007 Messages 74 Jun 26, 2007 #13 It works now. Thanks for the help.
Bratlien Access Rookie Local time Today, 04:11 Joined Jun 14, 2007 Messages 17 Jun 26, 2007 #14 Nice crash course in SQL.