'PHP & SQL | JOIN table with same field | Result not giving me the field I want
I have 2 Tables, Order & Member. I need to show some records in Order and who made that order, so I use sql JOIN.
However both Tables have this field called "status" (same spelling). I need to display the Order.status, but my result is giving me Member.status.
Am I going to have to, instead of using SELECT *, list all the fields that I want in order to get Order.status? Or is there another simpler way? There are many fields I want to display, so it will be quite long.
$query = "SELECT * FROM orders INNER JOIN member ON orders.customerid=member.sno";
...
echo $row[status];
Do I have to do:
$query = "SELECT order.A, order.B, order.status, member.status, member.X ... FROM orders INNER JOIN member ON orders.customerid=member.sno";
Kind Regards
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
