Hi,
I am not being able to figure out how to SQL my requirement.
Any help would be greatly appreciated.
Table 1:
--------
codeID -PK
codeNum -PK
title
dept_cd
status_cd
---------
Table 2
History of Table 1)
Note : CodeNum in Table 1 could change. It is when this change occurs that the record moves to history Table.
--------
codeID -PK
codeNum -PK
title
dept_cd
status_cd
---------
Table 3:
--------
codeNew -PK
codeID
codeNum
year
type_cd
..
..
--------
Table 4: (code table)
-------
dept_cd -PK
dept_nm
------
Table 5: (code table)
-------
type_cd -PK
type_nm
------
Most of the data I am interested resides in Table 3.
Requirement:
Retrieve codeNew,codeID,codeNum,title FROM [TABLE 3] where year = '1991' and dept_cd = 1 and type = 'A'
(JOIN with both Table 1 and Table 2)
Thanks,
RajKum.
I am not being able to figure out how to SQL my requirement.
Any help would be greatly appreciated.
Table 1:
--------
codeID -PK
codeNum -PK
title
dept_cd
status_cd
---------
Table 2
Note : CodeNum in Table 1 could change. It is when this change occurs that the record moves to history Table.
--------
codeID -PK
codeNum -PK
title
dept_cd
status_cd
---------
Table 3:
--------
codeNew -PK
codeID
codeNum
year
type_cd
..
..
--------
Table 4: (code table)
-------
dept_cd -PK
dept_nm
------
Table 5: (code table)
-------
type_cd -PK
type_nm
------
Most of the data I am interested resides in Table 3.
Requirement:
Retrieve codeNew,codeID,codeNum,title FROM [TABLE 3] where year = '1991' and dept_cd = 1 and type = 'A'
(JOIN with both Table 1 and Table 2)
Thanks,
RajKum.