Синтаксис SQL
- Note: это тоже что и JOIN.
Пример SQL
There is a table "Persons":
| P_Id | LastName | FirstName | Address | City |
|---|---|---|---|---|
| 1 | Hansen | Ola | Timoteivn 10 | Sandnes |
| 2 | Svendson | Tove | Borgvn 23 | Sandnes |
| 3 | Pettersen | Kari | Storgt 20 | Stavanger |
| O_Id | OrderNo | P_Id |
|---|---|---|
| 1 | 77895 | 3 |
| 2 | 44678 | 3 |
| 3 | 22456 | 1 |
| 4 | 24562 | 1 |
| 5 | 34764 | 15 |
For this we use this query:
Query Result:
| LastName | FirstName | OrderNo |
|---|---|---|
| Hansen | Ola | 22456 |
| Hansen | Ola | 24562 |
| Pettersen | Kari | 77895 |
| Pettersen | Kari | 44678 |






Comments
Thanx. Quote
SELECT cat,(SELECT COUNT(*) FROM t t ON cat.id = t.id) FROM t
error
Not unique table/alias: 't' Quote
Example: the table "Persons" add two more field "Date" and "Opis_OrderNo", in the "Opis_OrderNo" is filled with text that is owned by OrderNo table "Orders" (a single cell "OrderNo" can belong to multiple cells "Opis_OrderNo", task:
assigned to each cell "OrderNo" table "Orders" on the last time value in the "Opis_OrderNo" table "Persons" Quote