2 years ago
#389268

Andrei
MySQL - creating a query
I need some help, I want to create a query and is difficult for me, how can I create a query to sort table A by value and if the values are equal to check in table B by which value are higher between value1 and value 2?
As example first 2 rows from table A have the same value, so if we compare with table B the order should be 2,1 because in table B 5>3
table A
| id | value | 
|---|---|
| 1 | 4 | 
| 2 | 4 | 
| 3 | 6 | 
table B
| id1 | id2 | value1 | value2 | 
|---|---|---|---|
| 1 | 2 | 3 | 5 | 
| 1 | 3 | 5 | 2 | 
mysql
sql
0 Answers
Your Answer