http://www.perlmonks.org?node_id=41067

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: (database programming)

My problem is that I have two (more, actually, but I'm only going to talk about two here) tables. They both have a column named gene_id, but one of them (primary.gene_id) actually identifies the gene, and the other (secondary.gene_id) specifies that the row in the secondary table should be attached to the gene.

My problem is that if there is nothing in the secondary table that matches the primary table, gene_id gets overwritten with undef when I call $query->fetchrow_hashref.

I am currently using a LEFT JOIN to join the tables.

Is there a way that I can solve this without renaming the column in the secondary table? I'd really like for the column names to be the same just so I can keep my database (mostly) consistent.

Originally posted as a Categorized Question.