Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Rename columns within a query?

Guest
Mar 11, 2008 Mar 11, 2008
Is there a way that I can rename a column within a coldfusion query? I've attached an example.

I've joined a table with the same table here and have named them A and B. I want to be able to rename the columns in B so that, when I display the output, they do not have the same names as in A. (Eg. b_pkgname and b_pkgrev).
TOPICS
Database access
554
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 11, 2008 Mar 11, 2008
Brandi L wrote:
> Is there a way that I can rename a column within a coldfusion query?

Yup and in any other technology making use of SQL that supports the
alias 'AS' statement.

I.E.

SELECT
a.site,
a.pkgname,
a.pkgrev,
b.pkgname AS b_pkgname,
b.pkgrev AS b_bkgrev
...


I hear good things about Ben Forta's "Teach Yourself SQL in 10 Minutes"
as well as the many SQL references and tutorials available on the internets.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 12, 2008 Mar 12, 2008
LATEST
Thanks for the assistance! I learned a little SQL in school but I'm definitely rusty. Its funny - I googled this and couldn't find the answer I was looking for. I'll check out Forta's tutorial. :)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources