I need help on how to query this scenario
Suppose i have this tables:
TABLE1
+--------+-------+
| usr | value |
+--------+-------+
| werty1 | 789 |
| werty2 | 789 |
| werty3 | 1111 |
| werty4 | 3423 |
| werty5 | 234 |
| werty6 | 234 |
+--------+-------+
TABLE2
+--------+-------+
| usr | value |
+--------+-------+
| werty1 | 789 |
| werty2 | 789 |
| werty3 | 3423 |
| werty4 | 3423 |
| werty5 | 222 |
| werty6 | 333 |
+--------+-------+
I would like to get the result only to those usr and exist both on TABLE1 and TABLE2 that their value is different.
the expected output:
werty3 11111 3423
werty5 234 222
werty6 234 333
I still get stuck on how to query this stuff and as of now, im experimenting on this query hoping to gain new
Any advise?
Suppose i have this tables:
TABLE1
+--------+-------+
| usr | value |
+--------+-------+
| werty1 | 789 |
| werty2 | 789 |
| werty3 | 1111 |
| werty4 | 3423 |
| werty5 | 234 |
| werty6 | 234 |
+--------+-------+
TABLE2
+--------+-------+
| usr | value |
+--------+-------+
| werty1 | 789 |
| werty2 | 789 |
| werty3 | 3423 |
| werty4 | 3423 |
| werty5 | 222 |
| werty6 | 333 |
+--------+-------+
I would like to get the result only to those usr and exist both on TABLE1 and TABLE2 that their value is different.
the expected output:
werty3 11111 3423
werty5 234 222
werty6 234 333
I still get stuck on how to query this stuff and as of now, im experimenting on this query hoping to gain new
Code:
select usr,value from TABLE1 where usr in (select usr from TABLE2) and value in (select values from TABLE2);
Comment