I have two tables in my database that have no relation between. The first table have a description of old_item. The second table have a description of an update of those old_item.
For example,
Table 1
mysql> SELECT
coil_no
FROM coil
WHERE coil.coil_no = "DNA07X2B419011701A";
Empty set (0.00 sec)
Table 2
mysql>SELECT
coil_no
FROM stock_taking_hanwa
WHERE stock_taking_hanwa.coil_no = "DNA07X2B419011701A";
+--------------------+
| coil |
+--------------------+
| DNA07X2B419011701A |
+--------------------+
1 row in set (0.00 sec)
If you can see, coil_no is the key. I use inner join like this :
SELECT
c.coil_no as old_item,
sth.coil_no as newest_item
FROM coil c
INNER JOIN stock_taking_hanwa sth
ON sth.coil_no = c.coil_no
WHERE c.coil_no = "DNA07X2B419011701A" OR sth.coil_no = "DNA07X2B419011701A"
But it gives me Empty set (0.00 sec)
.
I need the format like this :
+--------------------+--------------------+
| old_item | new_item |
+--------------------+--------------------+
| | DNA07X2B419011701A |
+--------------------+--------------------+
Note : Sometimes in another case, its vice versa.
+--------------------+--------------------+
| old_item | new_item |
+--------------------+--------------------+
| "Some item" | |
+--------------------+--------------------+