This is not my area of expertise, but is probably pretty easy...If someone can help out it would be greatly appreciated.
Given the below query:
I get the following (abbreviated) results:
I need to create an update query to update the last column (parent_id) for each record. Of course, parent is a record that has the last column NULL, so in the sample data, id 11 should have a parent of 1391, id 1391 should have a parent id of 1394, etc.
Anyone have a starting point they can help me out with?? Thanks.
=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)
Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB.NET Programmer
Given the below query:
Code:
select
pst.cnfrm_prod_grp_sub_prod_trans_type_assn_id
, pst.cnfrm_prod_grp_code
, st.cnfrm_sub_prod_type_code
, st.cnfrm_trans_type_code
, pst.parent_assn_id
from dbo.cnfrm_prod_grp_sub_prod_trans_type_assn pst
left join dbo.cnfrm_sub_prod_trans_type_assn st
on pst.cnfrm_sub_prod_trans_type_assn_id = st.cnfrm_sub_prod_trans_type_assn_id
where cnfrm_prod_grp_code = 'agy'
order by pst.cnfrm_prod_grp_code
, st.cnfrm_sub_prod_type_code
, st.cnfrm_trans_type_code
I get the following (abbreviated) results:
Code:
cnfrm_prod_grp_sub_prod_trans_type_assn_id cnfrm_prod_grp_code cnfrm_sub_prod_type_code cnfrm_trans_type_code parent_assn_id
1374 agy NULL NULL 1372
1391 agy adi NULL NULL
11 agy adi buy NULL
16 agy adi can NULL
14 agy adi oob NULL
15 agy adi oos NULL
17 agy adi rev NULL
12 agy adi sel NULL
13 agy adi whi NULL
1392 agy bfc NULL NULL
18 agy bfc buy NULL
19 agy bfc can NULL
20 agy bfc oob NULL
21 agy bfc oos NULL
22 agy bfc rev NULL
23 agy bfc sel NULL
1393 agy dbt NULL NULL
I need to create an update query to update the last column (parent_id) for each record. Of course, parent is a record that has the last column NULL, so in the sample data, id 11 should have a parent of 1391, id 1391 should have a parent id of 1394, etc.
Anyone have a starting point they can help me out with?? Thanks.
=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)
Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB.NET Programmer