I have two tables like following:
Table one is named KLASA which has following two columns:
here is primary key (ID_Klasa) and (KlasaViti)
Table two is maed PARALELJA which has following three columns:
primary key (ID_Paralelja) (Paralelja) and (ID_Klasa).
What I'm pretending to do is to make a query to get the combination of KlasaViti from first table and Paralelja from second table. The result of that I want to insert into table two.
for example table one has ID_Klasa=3 , KlasaViti=2, table two has ID_Paralelja=3, Paralelja=1. I want to automatically find the combination of Klasa=2 and Paralelja=3 and to get the ID_Klasa from table one, that value I want to insert at the ID_klasa at the table two.
I'm little bit confused how to do that.
Here is some code what I'm trying but I'm having no result:
SELECT k.ID_Klasa FROM [Projekti_TI_1].[dbo].[KLASA] AS k
JOIN [Projekti_TI_1] .[dbo].[PARALELJA] as p on
k.KlasaViti = p.Paralelja
where k.ID_Klasa = p.ID_Klasa
Thank you in advance for taking time reading this request.
Cheers.
EDIT:
Probably I did not made my request properly. I think that following picture shows you my problem.
<img src="http://i444.photobucket.com/albums/qq165/dr_iton/SQLstatement_zps6d18d49f.jpg" border="0" alt=" photo SQLstatement_zps6d18d49f.jpg"/>