RE: Distinct insert

From: Robert (Robert_at_discussions.microsoft.com)
Date: 08/27/04

  • Next message: Gary K: "Re: Only get dates"
    Date: Fri, 27 Aug 2004 12:07:07 -0700
    
    

    Actualy That looks very much like what Hugo came up with. I just did'nt think
    about grouping the "Lic Tag" field.

    I've remembered this so I'll be sure to do it again if I have to do this
    again.

    "Dan" wrote:

    > Have you tried something like:
    >
    > insert into Accounts (AccountsOID,Account)
    > select min( "Rec NO" ) + 100 as AccountsOID, "LIC
    > TAG" as Account from AutoExpt group by "LIC TAG"
    >
    > grahamdnle@yahoo.com
    > >-----Original Message-----
    > >I am trying to insert a record id primary at the same
    > time that I am trying
    > >to insert a Distinct Account number.
    > >
    > >The insert statement is something kind of like this:
    > >
    > >insert into Accounts (AccountsOID,Account)
    > > select Distinct "Rec NO" + 100 as
    > AccountsOID, "LIC TAG" as Account from
    > >AutoExpt
    > >
    > >In the AutoExpt table there are multiple occurrences
    > of "LIC TAG" values all
    > >of which need to be put into the Accounts table, however
    > there must be only
    > >one entry for the Lic tag in the accounts table. The Rec
    > No +100 is just to
    > >create a unique primary key for the AccountsOID.
    > >
    > >Is there anyway I can get only the Distinct Lic Tag's,
    > but at the same time
    > >get a unique primary key for them.
    > >
    > >Thanks,
    > >
    > >.
    > >
    >


  • Next message: Gary K: "Re: Only get dates"

    Relevant Pages

    • Distinct insert
      ... to insert a Distinct Account number. ... In the AutoExpt table there are multiple occurrences of "LIC TAG" values all ... of which need to be put into the Accounts table, ... create a unique primary key for the AccountsOID. ...
      (microsoft.public.sqlserver.mseq)
    • Distinct insert
      ... TAG" as Account from AutoExpt group by "LIC TAG" ... >insert into Accounts ... >create a unique primary key for the AccountsOID. ...
      (microsoft.public.sqlserver.mseq)
    • Re: Distinct insert
      ... >to insert a Distinct Account number. ... >of which need to be put into the Accounts table, ... >one entry for the Lic tag in the accounts table. ... >create a unique primary key for the AccountsOID. ...
      (microsoft.public.sqlserver.mseq)
    • Re: Distinct insert
      ... excel file into a new table in the SQL database. ... accounts table is not automatically generated, ... My theory is that if I add only the distinct account numbers and departments ... support on importing the data. ...
      (microsoft.public.sqlserver.mseq)