Hello Everyone,
I have the following tables:
Table A Table B
-------- -----------------------------
A_ID A_NAME B_ID APP_ID APP_NAME
1 10001 Name1
2 10001 Name1
3 10002 Name2
4 10003 Name4
5 10003 Name4
6 10003 Name4
5 10003 Name5
Table A needes to populate the data based on Table B.
I need to have the follwoing output in Table A
Table A:
---------
A_ID A_NAME
10001 Name1
10002 Name2
10003 Name4 (10003 has two APP_NAME, but we need to get only the first APP_NAME for 10003, ie Name4) Also App_NAME has null values, I need to ignore null.
I tried Insert Into with select statment, but the output for table A had dupilcate records.
Can someone help me with the query?
Thanks!
I have the following tables:
Table A Table B
-------- -----------------------------
A_ID A_NAME B_ID APP_ID APP_NAME
1 10001 Name1
2 10001 Name1
3 10002 Name2
4 10003 Name4
5 10003 Name4
6 10003 Name4
5 10003 Name5
Table A needes to populate the data based on Table B.
I need to have the follwoing output in Table A
Table A:
---------
A_ID A_NAME
10001 Name1
10002 Name2
10003 Name4 (10003 has two APP_NAME, but we need to get only the first APP_NAME for 10003, ie Name4) Also App_NAME has null values, I need to ignore null.
I tried Insert Into with select statment, but the output for table A had dupilcate records.
Can someone help me with the query?
Thanks!