Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 20th, 2004, 04:11 PM
Registered User
 
Join Date: Dec 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Query help

I am new to this forums...

I wanted an help on a query

I have 3 access table

1. Manufacture Table - contains info about manufacturers
    * mfr_id
    * mfr_name
    * mfr_address
2. Products Table - contains info about manufacturers products. An manuf may have more than one product and we use the mfr ID to link the product to the manuf.
    * product_id
    * mfr_id
    * product_name
    * cat_id1
    * cat_id2
    * cat_id3
    * newest
3. Category Table - contains info on the categories and their names
    * cat_id
    * cat_name

* are the fields for the table

The field "newest" in the table "Products" is an integer. Higher the value the newer the product is.

I want an SQL query to get one product per mfr and the product should be the one with the highest newest value.

I would really like some help on the query.
 
Old December 21st, 2004, 06:06 AM
Friend of Wrox
Points: 486, Level: 7
Points: 486, Level: 7 Points: 486, Level: 7 Points: 486, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: Athens, , Greece.
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You have to inner_join the tables.
Then just order the records that will come to you from your query by the newest_product and use "DESC". The record that you`ll take is the one you are looking for.




Similar Threads
Thread Thread Starter Forum Replies Last Post
sql query i need seearam MySQL 7 November 30th, 2008 03:14 AM
Output Query to txt file from SQL Query everest SQL Server 2005 4 November 22nd, 2007 01:49 AM
SQL Query!! dpkbahuguna Beginning VB 6 5 October 12th, 2007 12:39 AM
Help with SQL query sattaluri Access 2 August 11th, 2006 09:26 AM
SQL query PinkyCat Classic ASP Databases 3 March 11th, 2005 01:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.