You can use select distinct to get distinct values

insert into table_one
select distinct value
from table_two

will take the distinct values from table_two and insert them into table_one

On Tue, 12 Oct 2004 14:20:12 -0400, Mark Spits <[EMAIL PROTECTED]> wrote:
> >Mark,
> >
> >
> >
> >Your select looks fine.  To do the insert you have to do each table in
> >turn.  Insert your user into tblOne first and get the UserID that is
> >assigned to that new user (I'm assuming that you're using some form of
> >auto-increment field for UserID) and then insert the path using the
> >UserID that you got from tblOne.
>
> Yes...I have the UserID in the main table (tblOne) set as an identity.
>
>
> >
> >To get the UserID for the new record you have to do either a select
> >Max(UserID) as NewUserID from tblOne or a select that you know will
> >return the record that you just inserted, eg. a creation date/time and
> >some of the user details.  The other alternative is to not use an
> >auto-increment field for your UserID and generate your user id, so that
> >you know what it will be before doing either insert.
>
> Hmm...nto sure what would be best. I also don't want duplicates.
>
> I got a headache...
>
>
> >Hope that helps
> >
> >Regards
> >
> >Stephen
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to