You can also do

 SELECT 'hyperlink_title'=tbl_Pages.title+' '+tbl_Categories.Name from
tbl_Pages,tbl_Categories

Joe
----- Original Message -----
From: "Dave Watts" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 4:02 PM
Subject: RE: 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.
>
> There's no way around this; that's just the way SQL works! Even if it did
> work - that is, if it didn't produce an error - what would you want this
to
> do?
>
> If you're trying to build one field that contains both of the other
fields,
> you can do that by simple concatenation:
>
> SELECT tbl_Pages.title + ' ' + tbl_Categories.Name AS hyperlink_title ...
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> voice: (202) 797-5496
> fax: (202) 797-5444
> 
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.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