It really depends on the DBMS you are using, but you can use aliases as
a trick to solve this problem:

select a.col1 as a_col1, b.col1 as b_col1 from a join b on a.id=b.id

This will return the two columns a_col1 and b_col1

Cheers,


Marco

-- 
------------
php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com


On Sat, 2002-11-23 at 10:18, Matt Friedman wrote:
> Is there a way in SQL to have the column names prefixed by the table
> name in a result set after a join?
> 
> Table A has column col1 and table B has columns col2 and col3
> 
> After the join I want the result set to have columns named
> 
> A.col1    B.col2     B.col3
> 
> Such that I can tell from which table each column came from.
> 
> Is this possible?
> 
> Matt Friedman 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to