1

I would like to know if it it possible to use for example an "INNER JOIN" with two table which have different field names.

Here is an example of my problem:

I have a table called virtuemart_orders where there is a field called order_status and which in this field the values are (P, R, X, C).

Then I have another table which is called virtuemart_orderstatus with a field named order_status_code with the values (P, R, X, C).

The thing is that I would like to be able to join these two tables using these fields because they are the only ones which seem more or less alike.

Would this be possible without having to change the name of the fields or anything else?

4

2 回答 2

2

您无需更改列的名称。只需在查询中指定它们

 SELECT * FROM virtuemart_orders T1
 INNER JOIN virtuemart_orderstatus T2
 ON T1.order_status=T2.order_status_code
于 2013-07-11T07:31:10.047 回答
0

是的,有可能

select t1.*,t2.* from t1 inner join t2 on (t1.order_status = t2.order_status_code)
于 2013-07-11T07:31:58.313 回答