You can simply specify the fields you want instead of using SELECT *
. In fact, using SELECT *
is considered bad practice for various reasons:
SELECT customer_Order.OrderNumber,
customer_Order.SomeFieldA,
customer_Order.SomeFieldB,
customer_Order.SomeFieldB,
optRelation.SomeOtherField1,
optRelation.SomeOtherField2,
optRelation.SomeOtherField3
FROM customer_Order, optRelation
WHERE customer_Order.OrderNumber = optRelation.OrderNumber AND
optRelation.OrderNumber = 21
You can also, (but you also shouldn't, in general) select all the fields of one table, and then explicitly select the fields of the second table:
SELECT customer_Order.*,
optRelation.SomeOtherField1,
optRelation.SomeOtherField2,
optRelation.SomeOtherField3
FROM customer_Order, optRelation
WHERE customer_Order.OrderNumber = optRelation.OrderNumber AND
optRelation.OrderNumber = 21