Query type problem...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm having trouble getting my head round the logic of something I'm trying
to do:

We have a table with lots of rows.  Each row has a column for 'range' and a
column for 'style'.  So, it might look something like this:

Range A | Style One | Colour One
Range A | Style One | Colour Two
Range A | Style One | Colour Three
Range A | Style One | Colour Four

The way that the database is constructed is not great but it's what I've got
to work with!

There are many ranges
Each range contains several styles
Each style is available in several colours

What I want to do is for the visitor to click on a range.  The page then
shows all the styles in that range and ONE colour (Doesn't matter which,
just the first one it finds)

They then click on a style and are shown a page where they can choose the
colour from a thumbnail.  This bit is done, it's the step before that I'm
stuck on.

Any help would gratefully received.


Re: Query type problem...

Quoted text here. Click to load it

select range, style, min(colour) as sample_color
from inventory
group by range, style

This will give you the first color (alphabetic).  (Untested)

--  Dan

Site Timeline