Trace,

What exactly is your intent?  It seems that you want to create a list of all
the hyperlink_title values, whether they appear in tbl_Pages or
tbl_Categories.  Is that right?

In other words, if you have tbl_Pages:

tbl_Pages_pk   hyperlink_title
1              A
2              B
3              C

..and tbl_Categories:

tbl_Categories_pk   hyperlink_title
1                   X
2                   Y
3                   Z

..your query output would be A, B, C, X, Y, Z.  Is that what you want?

I think that the trick is a union query.  Try something like this:

<cfquery name="getHyperlinks" datasource="#ds#">
    SELECT    tbl_Pages.title AS hyperlink_title
    FROM      tbl_Pages
    UNION
    SELECT    tbl_Categories.Name AS hyperlink_title
    FROM      tbl_Categories
</cfquery>

Hope that helps,
Matthieu

-----Original Message-----
From: Trace [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 3:36 PM
To: CF-Talk
Subject: Query question


Is there a way to refer to 2 fields in one query with the same name?

I have a field called "title" in table "tbl_Pages" and a field called "Name"
in table "tbl_Categories"

<cfquery name="getHyperlinks" datasource="#ds#">
    SELECT    tbl_Pages.title AS hyperlink_title, 
                      tbl_Categories.Name AS hyperlink_title
    FROM       tbl_Pages,  tbl_Categories
</cfquery>

Obviously the above gives me the error: Duplicate output alias
'hyperlink_title'

Is there a way around this? This is for cf 4.5.

Thanks,
Trace

______________________________________________________________________
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to