Results 1 to 2 of 2

Thread: SQL Synatax aarrrrrrgggghhhhhh !!!!

  1. #1

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Wink SQL Synatax aarrrrrrgggghhhhhh !!!!

    Code:
    Col1    Col2
       1       1
       1       2
       2       2
       3       3
    Here's what I'm basically trying to do, from what I can see, it doesn't look like I can do 2 set statements, and don't really want 2 sql strings in my coding, can anyone tell me a way to achieve the below please :
    Code:
    Update Table1
    Set Col1=A
    Where Col2 = 2 AND col1=1
    Set Col1=B 
    Where Col2=2 and col1=2

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  2. #2
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    Sorry to disappoint you, but I don't think that's possible. You can use two Set statements with a comma between the fields, but they will have a common WHERE clause. So if you are going to update two fields based on two different criteria, you have to use two separate SQL statements.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

Posting Permissions

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



Click Here to Expand Forum to Full Width