Join a column on a specific position (after a specific column)
For example SELECT a.*,b.3 FROM a JOIN b
and i want the get the b.3 for example between a.5 and a.6
Is i开发者_如何转开发t possible? Or should i solve it on the php-side?
Not possible. However using a.* is discouraged in production systems. You should list every field individually. I realize this can be a pain if there are too many fields. However this way you can get any order you want.
You will need to list the fields in a
specifically, i.e. one at a time, and not a.*
. Then you can put b.3
wherever you want.
You can also retrieve the data from the fields by name instead of by position in PHP, then you don't care about the order.
Is this what you're asking for?
SELECT a.1, a.2, a.3, a.4, a.5, b.3, a.6, ...
FROM a
INNER JOIN b ...
There is only one way:
SELECT a1, a2, a3, a4, a5, b3, a6, a7 FROM a JOIN b
精彩评论