질문이 참 어려운것 같은데
예를 들면 프로시져에서 ,
select count(*) into count1 from table1
select count(*) into count2 from table2
if count1 >0 and count2 > 0 then
insert into values select * from Main_table,
table1,table2
where Main_table.join_column1 = table1 =
table1.join_column1
and Main_table.join_column1 = table2 =
table2.join_column2
else if count1 >0 and count2 = 0 then
insert into values select * from Main_table, table1
where Main_table.join_column1 = table1 =
table1.join_column1
else if count1=0 and count2 >0 then
insert into values select * from Main_table, table2
where Main_table.join_column2 = table1 =
table1.join_column2
else
insert into values select * from Main_table
end
이러한 방법으로 해야 하는데
쿼리가 너무 길고 count를 해야 할 테이블 컬럼이 여러개라..
프로시져에서 위와 같은 방법이 아닌 다른 방법이 있는지 이렇게
질문을 올려 봅니다.
혹시나 좋은 의견 있으면 답변 부탁 드립니다.
|