Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Error

Status
Not open for further replies.

sd110404

Programmer
Nov 3, 2004
63
US
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!
 
Thank you for all your valuable time. Please ignore the post, as I have found my query working fine. I was doing a wrong join.

Thanks Again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top