Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2002-02-25 : 18:29:59
|
| Ok I just had to normalize some tables and now I have to move that data over to the new tablesIs there a way I can do the following statement? Inserting 3 columns from 3 selected columns? I know the syntax is off but hopefully it helps in showing what I am trying to do. Thanks aloginsert into tblThumbs(userID), tblThumbs(thumbID), tblThumbs(thumbStatus) select userID from tblUserdetails where thumb1 = 1, 1, 1 |
|
|
Tigger
Yak Posting Veteran
85 Posts |
Posted - 2002-02-25 : 18:58:43
|
| Your query should look something like thisinsert into tblThumbs(userID, thumbID, thumbStatus) select userID, <value2>, <value3> from tblUserdetails where ??? replace <value2> and <value3> with the values/fields you want to go into thumbID and thumbStatus.Not sure what your where clause should be - I didn't understand "thumb1 = 1,1,1" . Can you expand a bit more on what you want the where clause to be ? |
 |
|
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2002-02-25 : 19:28:16
|
| thanks that was all I needed...these 3 statements was what I was trying to get at ;) insert into tblThumbs(userID, thumbID, Status) select userID, 1, 1 from tblUserdetails where thumb1= 1insert into tblThumbs(userID, thumbID, Status) select userID, 2, 1 from tblUserdetails where thumb1= 2insert into tblThumbs(userID, thumbID, Status) select userID, 3, 1 from tblUserdetails where thumb1= 3 |
 |
|
|
ToddV
Posting Yak Master
218 Posts |
Posted - 2002-02-26 : 08:41:10
|
| How about this:insert into tblThumbs(userID, thumbID, Status) select userID, thumbid, 1 from tblUserdetails where thumb1 < 3 |
 |
|
|
|
|
|
|
|