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 |
|
exopolitix
Starting Member
1 Post |
Posted - 2009-11-03 : 12:32:56
|
| Hi.I am new to SQL, I am trying to insert information from one already made table into a set of tables I have created. For example my code is laid out similiar to this:INSERT INTO **mytable**SELECT DISTINCT *value*, *value2*FROM **premade table**;The only problem I have is that when I have a primary and a foreign key in a table it wont work. I think its because of the DISTINCT and it will only let the foreign keys be displayed once also. So basically I think (im not really to sure about it) I want a SELECT DISTINCT for my primary key and then SELECT for the rest. But when I try to do this it moans that my first statement does not have enough values.Any insight into this would be really really helpful. Cheers. |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
|
|
|
|
|