Error FIX: Column Name Appears More Than Once In Result Column
Okay, so I kept getting this error and it finally dawned on me that it means exactly what it says, lol. I was trying to run a stored procedure and had a query where the name field was selected twice like this:
SELECT M.name, A.address, A.phone, M.email, M.name FROM members M inner join address A on M.id = A.id;
Silly me. Removing the duplicate field or giving it an alias solves the problem.
thanks heaps… although still looking can’t see 2 columns with the same name
hehe found it!
Sometimes it also happens if you’re joining two tables that have the same column and you’re not running a natural join. For instance if you did something like:
SELECT A.*, B.* FROM address A LEFT OUTER JOIN badaddress B
If A and B both have a field with the same name you’ll have the same problem.