I think this will do what you want:

<cfquery name="qArticleByIndustry" datasource="#DSN#">
SELECT
A.id, A.article_title, A.article_date,
I.indus_name
FROM
Articles A,
Industry I
WHERE
I.industry_id=A.indus_id
ORDER BY
I.indus_name, A.article_date DESC
</cfquery>

<cfoutput query="qArticleByIndustry" group="indus_name">
#indus_name#<br>
<cfoutput query="qArticleByIndustry">
<blockquote>
#article_title# - #DateFormat(article_date,"mmmm, yyyy")#<br>
</blockquote>
</cfoutput>
</cfoutput>

--- Les Mizzell <[EMAIL PROTECTED]> wrote:

> Here's a two table query (SQL Server) that's giving me a problem...
>
> Table 1: Articles (Couple hundred of these)
> -----------------------------------------------
> id
> article_title
> article_date
> indus_id (each article is associated with an industry)
>
> Table 2: Industry (and there's maybe 60 industries in the table)
> ----------------------------------------------------------------
> industry_id
> indus_name
>
> Now, I've got no problem finding the associated articles and industries
>
> on an individual basis, but the client wants a single index page of
> articles grouped by industry, sorted alpha and then by article date
> like:
>
> AUTOMOTIVE
>      article #1 - May, 1994
>      article #2 - April, 1994
>      article #3 - March, 1994
> HOUSING AND DEVELOPMENT
>      article #1 - Jan, 1994
>      article #2 - Dec, 1993
> MEDICINE
>      article #1 - June, 1993
>      article #2 - May, 1992
>
> I keep coming up with convoluted ways of maybe doing this, but none
> seem
> to work properly.
>
> Pointers please?


_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to