On 07/02/2012 03:38 PM, Scott Baker wrote:
On 07/02/2012 03:34 PM, Matijn Woudt wrote:
Why the #### would you want to return 2 columns with the same name?
To be short, there's no such function, so you have to:
1) Rename one of the columns
2) or, use fetch_row with numerical indexes instead of fetch_assoc.
My "real world" scenario was this
SELECT a.CustID, b.*
FROM Customer a
LEFT JOIN Sales B USING (CustID)
WHERE a.CustID = 1234;
In that case, there was a record in Customer, but not in Sales. Sales
returned CustID as NULL, which overwrote the one from Customer.
It was my mistake, and the SQL was easily fixed. But it woulda been nice
to have PHP realize there was a dupe when it was building that array to
return to me.
You could always do this.
SELECT b.*, a.CustID
FROM Customer a
LEFT JOIN Sales B USING (CustID)
WHERE a.CustID = 1234;
--
Jim Lucas
http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php