Fixed union query since union combines results from two queries, but the number of columns and their data types must match.
This commit is contained in:
parent
3dc24979ba
commit
dcadee52ce
@ -90,7 +90,7 @@ SELECT name, cost, domain, quantity FROM Companies RIGHT JOIN Orders on Companie
|
|||||||
|
|
||||||
4. Find names, costs, domains and quantities for companies using Union operator.
|
4. Find names, costs, domains and quantities for companies using Union operator.
|
||||||
```sql
|
```sql
|
||||||
SELECT name, cost FROM Companies UNION SELECT domain, quantity FROM Orders;
|
SELECT name AS info, cost AS value FROM Companies UNION SELECT domain AS info, quantity AS value FROM Orders;
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user