SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict Huscy's Avatar
    Join Date
    Jul 2002
    Location
    Newcastle, UK
    Posts
    318
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    quick sql question

    CAn you combine these 2 queries into 1?
    update table set points = $pts where clubname="$clubname" and position="gk"

    and

    update table set points = $pts where clubname="$clubname" and position="d1"

    ?

    I know there is a mysql forum area, but i got zero reply there

  2. #2
    PHP Developer W1LL's Avatar
    Join Date
    Apr 2001
    Location
    Leicester, UK
    Posts
    459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This should work!

    [sql]UPDATE TABLE SET Points = $pts WHERE Clubname = "$clubname" AND (Position = "gk" OR Position = "d1")[/sql]

    - Will

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    Singapore
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    UPDATE TABLE SET Points = $pts WHERE Clubname = '$clubname' AND Position IN ('gk', 'd1' )

  4. #4
    SitePoint Addict Huscy's Avatar
    Join Date
    Jul 2002
    Location
    Newcastle, UK
    Posts
    318
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah thanks

    i didnt know you could use brackets like that - ta again


Bookmarks

Posting Permissions

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