You need to change the ORDER BY:
ORDER BY dbo.listings.location_id, dbo.styles.style_name,
dbo.listings.id ASC

And then you can group the CFOUTPUT
<cfoutput query="qTest" group="location_id">
<h1>#qTest.location_name#</h1>
        <cfoutput group="style_name">
        <h2>#qTest.style_name#</h2>
                <cfoutput>
                <!--- All details come here --->
                #qTest.address1#<br>
                </cfoutput>
        </cfoutput>
</cfoutput>

-----Original Message-----
From: JLH All Turbo [mailto:[EMAIL PROTECTED]] 
Sent: vrijdag 9 augustus 2002 15:50
To: CF-Talk
Subject: Re: SQL Help


Actually let me show you

SELECT      dbo.listings.address1, dbo.listings.city,
dbo.listings.address1,
dbo.listings.zip, dbo.listings.year_built, dbo.listings.sq_feet,
dbo.listings.bedrooms, dbo.listings.bathrooms, dbo.listings.lot_size,
dbo.listings.price, dbo.listings.short_description,
dbo.listings.location_id, dbo.listings.agent_id, dbo.styles.style_name,
dbo.locations.id, dbo.locations.location_name
FROM         dbo.listings, dbo.styles, dbo.locations
WHERE       dbo.listings.style_id = dbo.styles.id AND
                   dbo.listings.location_id = dbo.locations.id

ORDER by dbo.listings.location_id, dbo.listings.id ASC

I have a listings, styles, and locations tables

I want to pull the info out of LISTINGS where LOCATIONS = <#value#> and
groupby the STYLES.

Then I want in the output, if 5 styles happen to be selected have each
style have a header with the pertaining LISTING underneath each style
header.

so


LOCATION=LOS ANGELES

HEADER: SINGLE FAMILY HOME
HOUSE1
HOUSE2

HEADER: APARTMENT
HOUSE3
HOUSE4

HEADER: COMMERCIAL LOT
LOT1
LOT2


I can pretty much get the data out... it's just the CFOUTPUT.. I don't
know how to get the headers to show up... it's organizing the data by
the style it's just... I want each style to have a header when
outputted.

I hope this makes more sense. :-)

J

----- Original Message -----
From: "Matthew Walker" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, August 09, 2002 9:44 AM
Subject: Re: SQL Help


> Make sure you are ordering by LocationName, then
>
> <cfoutput query="..." group="LocationName">
>     <h1>#LocationName#</h1>
>     <cfoutput>
>         #Ball#
>     </cfoutput>
> </cfoutput>
>
> Is that what you mean??
>
> ----- Original Message -----
> From: "JLH All Turbo" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Saturday, August 10, 2002 1:36 AM
> Subject: SQL Help
>
>
> > How can I structure a query and it's output to pull all the records 
> > out
> that
> > have a certain field = something and have them grouped by another
field...
> >
> > And then in the output put a header for each group?
> >
> > In a DB with baseballs and footballs and different locations for the
> balls.
> >
> > Pull all balls out and group by locations
> >
> > So the output would be something along the lines of
> >
> > LOCATION1NAME
> > baseball1
> > baseball2
> > football1
> > football2
> >
> > LOCATION2NAME
> > baseball3
> > baseball4
> > football3
> > football4
> >
> > etc and run through all the locations and all the balls that pertain

> > to those locations.  I can get the query down, just outputting the 
> > <cfoutput> to change the header of the tables is where I'm running 
> > in to problems.
> >
> > Maybe you guys can help?
> >
> > J
> >
> >
> >
> 

______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to