Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Aug 2002
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help with SQL (2K)

    This is my statement,

    INSERT INTO events
    VALUES (1, 1, 3, (select max(WhenID) from when));

    Everything works fine with the nested query if I use SELECT. What's the problem with INSERT?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: help with SQL (2K)

    I don't think Access SQL likes the combination of VALUES and a nested SELECT query. Try

    INSERT INTO events (Field1, Field2, Field3, Field4)
    SELECT 1, 1, 3, Max(WhenID) FROM When;

    where Field 1 .. Field4 must be replaced by the actual field names.

  3. #3
    Lounger
    Join Date
    Aug 2002
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: help with SQL (2K)

    Yes, that worked beautifully. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •