Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Answer: How do I get "table.column" format from a select/join?

by extremely (Priest)
on Nov 11, 2000 at 16:46 UTC ( #41086=categorized answer: print w/replies, xml ) Need Help??

Q&A > database programming > How do I get "table.column" format from a select/join? - Answer contributed by extremely

Lordy, don't change the column names. You can alias the name with AS in most SQL dialects:
SELECT p.gene_id, s.gene_id AS SecGene, ...

If the gene_id in the second table is a foreign key into the primary table, you really want it to have the same name, for your and everyone elses sanity. I gotta ask, is the gene_id field the field that you use to tie the two tables together? If so, and you have:

... FROM primary LEFT JOIN secondary ON primary.gene_id=secondary.gene +_id ...
in your select, then you really shouldn't ask for anything but the primary.gene_id from the left side of the join.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2016-12-08 20:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (146 votes). Check out past polls.