Patric,

> My problem is that I don't really want the retrieved records to be ordered
> like stated in the ORDER BY-clause but to be grouped by these
> fields so that
> the output could look like this:
>
> {Heading} f_name1 / h_name3 / t_name9
>   {entry 1}
>   {entry 2}
>   {entry 3}
> {Heading} f_name1 / h_name3 / t_name11
>   {entry 1}
>   {entry 2}
> {Heading} f_name2 / h_name1 / t_name4
>   {entry 1}
>   {entry 2}
>   {entry 3}
>   {entry 4}

Sound like maybe you want to do something like this...

<cfquery name="quicksearch" datasource="ersatzteile">
    SELECT eintraege.id, eintraege.fzg_typ_id, eintraege.hersteller_id,
eintraege.bereich_id, eintraege.datum, eintraege.eintragstext,
eintraege.preis, fzg_typ.name+'/'+hersteller.name+'/'+teilebereich.name AS
header_name
    FROM eintraege, fzg_typ, hersteller, teilebereich
    WHERE eintragstext LIKE '%#FORM.suchbegriff#%'
       AND fzg_typ.fzg_typ_id = eintraege.fzg_typ_id
       AND hersteller.hersteller_id = eintraege.hersteller_id
       AND teilebereich.bereich_id = eintraege.bereich_id
    ORDER BY  headername
</cfquery>

<cfoutput query="quicksearch" group="headername">
#headername#
        <cfoutput>
                ....The rest of the record....
        </cfoutput>
</cfoutput>

This will loop through your query grouping all the records together by
headername, giving you an output like the one you showed above.

Be aware - I'm not sure I have the syntax quite right for this part of the
query :
        fzg_typ.name+'/'+hersteller.name+'/'+teilebereich.name AS header_name
So you may have to experiment... ;o)

Regards

Stephen

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to