I have 3 tables.
1 main table - Component with columns - ID, name_of_component, ID_component
And 2 tables of components
first - Hardisk with columns - ID, capacity
second - RAM with columns - ID, speed
In main table I have ID of component, and details of it are in tables hardisk or RAM. Column name_of_component choses hardisk or RAM and ID_component choses the right details from that chosen table.
for example lets say in Main table is this row
- 1,RAM,2
and in RAM table are two rows
- 1,2GB
- 2,4GB
I tried something like this
Select *
from (Select name_of_component
from Component
where ID=1)
join Component on (Select name_of_component
from Component
where ID=1).ID = Component.ID_component
But it doesn't work. So is there any way, how to call information from table which name is selected from another table pls ? I cant use one table for details of RAMs and Graphic cards, because they have different details. So how can I do this ?
The syntax error is You entered an SQL statement that has an invalid FROM clause.