Subject Re: [ib-support] Calling all SQL Guru's (How do I add an ORDER BY C.DESCRIPTION to this complex SQL statement?)
Author M Tuttle
Hmmm,

Thanks for the reply Helen.

ORDER BY C.DESCRIPTION does not work, whereas ORDER BY 4 does.

Why is this?

Mike

----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <ib-support@yahoogroups.com>
Sent: Sunday, June 09, 2002 9:08 AM
Subject: Re: [ib-support] Calling all SQL Guru's (How do I add an ORDER BY
C.DESCRIPTION to this complex SQL statement?)


> At 08:45 AM 09-06-02 -0500, you wrote:
> >This SQL statement works great, except the DESCRIPTION column is not in
> >alpha order. How can I make it this way?
> >
> >Thanks any pointers.
> >
> >Mike
> >
> >SELECT DISTINCT CAST(1 AS SMALLINT) AS SELECTED,
> > CC.CATALOG_ID,
> > C.CATEGORY_ID,
> > C.DESCRIPTION
> >FROM CATALOG_CATEGORY CC
> >JOIN CATEGORY C ON C.CATEGORY_ID = CC.CATEGORY_ID
> >WHERE CC.CATALOG_ID = :CATALOG_ID
> >
> >UNION
> >
> >SELECT DISTINCT CAST(0 AS SMALLINT) AS SELECTED,
> > CC.CATALOG_ID,
> > C.CATEGORY_ID,
> > C.DESCRIPTION
> >FROM CATEGORY C
> >LEFT OUTER JOIN CATALOG_CATEGORY CC ON CC.CATEGORY_ID = C.CATEGORY_ID
> >WHERE CC.CATEGORY_ID NOT IN (SELECT CC2.CATEGORY_ID
> > FROM CATALOG_CATEGORY CC2
> > WHERE CC2.CATALOG_ID = :CATALOG_ID)
>
> ORDER BY 4
>
> cheers,
> heLen
>
>
> All for Open and Open for All
> Firebird Open SQL Database · http://firebirdsql.org ·
> http://users.tpg.com.au/helebor/
> _______________________________________________________
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>