Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. a query !!! please help me fast fast fast

a query !!! please help me fast fast fast

Scheduled Pinned Locked Moved Database
databasehelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    reza assar
    wrote on last edited by
    #1

    i what to have an insert transact in ms access 2003 this insert statement should retrieve an ID from another table and then insert informations some thing like :

    insert into myTable values(123,'123',123,123,
    (select DISTINCT ID from ServiceGroupsInfo where NodeName='abc') )

    :(( :(( :(( but it does not work what should i do????? please help me!

    J T 2 Replies Last reply
    0
    • R reza assar

      i what to have an insert transact in ms access 2003 this insert statement should retrieve an ID from another table and then insert informations some thing like :

      insert into myTable values(123,'123',123,123,
      (select DISTINCT ID from ServiceGroupsInfo where NodeName='abc') )

      :(( :(( :(( but it does not work what should i do????? please help me!

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      reza assar wrote:

      but it does not work what should i do?????

      In the first instance I would suggest you read the forum guidlines, In the second I would define "Doesn't work".

      1 Reply Last reply
      0
      • R reza assar

        i what to have an insert transact in ms access 2003 this insert statement should retrieve an ID from another table and then insert informations some thing like :

        insert into myTable values(123,'123',123,123,
        (select DISTINCT ID from ServiceGroupsInfo where NodeName='abc') )

        :(( :(( :(( but it does not work what should i do????? please help me!

        T Offline
        T Offline
        The Man from U N C L E
        wrote on last edited by
        #3

        Looks to me like you are missing the field list. Eg.

        insert into myTable
        (field1, field2, field3, field4, field5)
        values(123,'123',123,123,(select DISTINCT ID from ServiceGroupsInfo
        where NodeName='abc'))

        though I would further modify it to:

        insert into myTable
        (field1, field2, field3, field4, field5)
        Select Distinct
        123,'123',123,123, ID
        from ServiceGroupsInfo
        where NodeName='abc';

        I'm not convinced by the distinct either, as surely ServiceGroupsInfo is unique by NodeName, or it will give multiple results for ID anyway.

        If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups