Thursday, March 8, 2012

create new table format

Im new / novice user to writing SQL scripting. I have two tables and table1 has two columns

uslid and groupid,

uslid1, group1

uslid1, group2

uslid1, group3

uslid3, group1

uslid3, group3 etc

the second table2 has three columns

uslid, name, and location

uslid1, john, bldg 4

uslid2, jane, accounting

uslid3, joe, mail room

. I am trying to do a inner join but not working and not sure if this will work to create new temp table.

example of what i am trying to get in new temp table on one row:

uslid, name, location, groupid1, groupid2, groupid3

uslid1, john, bldg 4, group1, group2, group3

uslid3, joe, mail room, goup1, , group3

Hope i explained this ok. Im using 2003 server sql 2000 ver 7, thank you in advance.

Apart from the join issue, it sounds like you may not have the right database design. Here's a site that will lead you through the design effort and then explain the joins.

http://www.informit.com/guides/content.asp?g=sqlserver&seqNum=60&rl=1

Buck Woody

No comments:

Post a Comment