Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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?
[Lady_Aleena]: Bw, happy Turing day!

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2017-06-23 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (539 votes). Check out past polls.