Thread: join ?? how ??

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Location
    Denmark
    Posts
    69
    Rep Power
    18
    hi i have tried to make a little more complex query ( for me atleast trying to develop )
    anyway i have theese two tables:
    ips
    +-----------+--------+
    | ip | id |
    +-----------+--------+
    | 127.0.0.1 | id_3 |
    +-----------+--------+
    (just an ex.)

    sites
    +--------------+
    | id | count |
    +------+-------+
    | id_3 | 12 |
    +------+-------+
    (another ex.)

    now what i need to do is update the count with one ( add one to sites.count ) where the id is the one from ips where the ip is the surfers...
    you get it??

    i tried something like this, but unsuccessful

    UPDATE sites SET count=count+1 where id=(select id from ips where ip='127.0.0.1')

    how is it done??

    regards
    Simon
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,643
    Rep Power
    4492
    I don't think you can do a join with an UPDATE command. At least I couldn't get it to work...

    ---John Holmes...

Similar Threads

  1. Why is outer join so much slower than inner join?
    By VitalyB in forum MySQL Help
    Replies: 2
    Last Post: October 11th, 2003, 06:44 PM
  2. innner join or right join
    By scoutt in forum MySQL Help
    Replies: 2
    Last Post: April 30th, 2003, 12:55 PM
  3. Replies: 1
    Last Post: April 14th, 2003, 10:36 AM
  4. 2 tables LEFT JOIN(?) to 1 other table
    By miked2miked in forum MySQL Help
    Replies: 0
    Last Post: March 31st, 2003, 01:37 PM
  5. SELECT where data is comma delimited..
    By Robert_J_Sherman in forum MySQL Help
    Replies: 29
    Last Post: June 28th, 2001, 10:29 AM

IMN logo majestic logo threadwatch logo seochat tools logo