I have 3 tables.
First table name: Objects
| ID | Name |
|---|---|
| 1 | Ahmet |
| 2 | Hasan |
Second table name: Properties
| ID | Name |
|---|---|
| 1 | EyeColor |
| 2 | Height |
Third table name: Data
| ObjectID | PropertyID | Value |
|---|---|---|
| 1 | 1 | Blue |
| 1 | 2 | 1.70 |
| 2 | 1 | Green |
| 2 | 2 | 1.90 |
Using the above three tables, I want to create the following list with SQL.
| Name | EyeColor | Height |
|---|---|---|
| Ahmet | Blue | 1.70 |
| Hasan | Green | 1.90 |
I tried this transmission as sample SQL
SELECT Distinct Objects.Name, (SELECT * FROM Datas where PropertyID = Datas.PropertyID )
FROM Datas
INNER JOIN Objects ON Datas.ObjectID = Objects.ID
INNER JOIN Properties ON Datas.PropertyID = Properties.ID
Can someone help me please?