Google Answers Logo
View Question
 
Q: Automatic Prefixing Database Select Queries ( No Answer,   0 Comments )
Question  
Subject: Automatic Prefixing Database Select Queries
Category: Computers > Programming
Asked by: johnsmithms-ga
List Price: $200.00
Posted: 24 Aug 2006 16:00 PDT
Expires: 23 Sep 2006 16:00 PDT
Question ID: 759266
I have three tables with column types: (id, type, creation).  When I
do a Select statement I want to have them prefixed with the table
alias without aliasing each individual column with an AS statement.

 

I DON?T want to write out the fields like:

SELECT

            T1.id AS t1_id,

            T1.type AS t1_type,

            T1.creation AS t1_creation,

            T2.id AS t2_id,

            T2.type AS t2_type,

            T2.creation AS t2_creation,

            T3.id AS t3_id,

            T3.type AS t3_type,

            T3.creation AS t3_creation

 

I NEED a way to have them prefixed by the table alias, so I can use either

SELECT *

OR

SELECT

            T1.*,

            T2.*,

            T3.*

Without having to prefix the individual columns.

A function to prefix the tables is fine for an answer.  We are
currently using Postrgres.

Clarification of Question by johnsmithms-ga on 24 Aug 2006 17:26 PDT
The solution needs to work with any database table...

An example of something we're looking for might be:

SELECT
   magicfunction(T1.*, "t1_"),
   magicfunction(T2.*, "t2_"),
   magicfunction(T3.*, "t3_")
WHERE
   T1.id = T2.id AND
   T3.id = T2.id

The result would comeback  with all results prefixed  appropriately
and respectively  t1_... t2_... and t3_...
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy