Reputation: 1681
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?
Upvotes: 1
Views: 68
Reputation: 1763
Yeas it is possible
select t1.*,t2.* from t1 inner join t2 on (t1.order_status = t2.order_status_code)
Upvotes: 0
Reputation: 8937
You don't need to change the names of your columns. Just specify them in your query
SELECT * FROM virtuemart_orders T1
INNER JOIN virtuemart_orderstatus T2
ON T1.order_status=T2.order_status_code
Upvotes: 2