Hi all, I've a question to guru :) there're two tables: mysql> show fields from domains; +--------+--------------+------+-----+---------+---------------- | Field | Type | Null | Key | Default | Extra +--------+--------------+------+-----+---------+---------------- | id | int(10) | | PRI | NULL | auto_increment | domain | varchar(255) | | | | | count | int(10) | | | 0 | +--------+--------------+------+-----+---------+---------------- 3 rows in set (0.01 sec)
mysql> show fields from banners; +-------+--------------+------+-----+---------------+----------- | Field | Type | Null | Key | Default | Extra +-------+--------------+------+-----+---------------+----------- | id | int(10) | | PRI | NULL | auto_incre | did | int(10) | | | 0 | | text | varchar(255) | | | not specified | | count | int(10) | | | 0 | +-------+--------------+------+-----+---------------+----------- 4 rows in set (0.00 sec) and a query: select ifnull(domains.id,0) as id, ifnull(domains.domain,'no such domain') as domain, if(b.count,b.count+1,0) as count from banners b inner join domains on b.did=domains.id where domains.domain like 'domain.com'; I think this query is pretty simple, and I want to do following: select ifnull(domains.id,0) as id, ifnull(domains.domain,'no such domain') as domain, /// here I want to get the b.count already incremented (+1) /// and update my column b.count with new value in one query. /// for example: /// if(b.count,(update b set count:=count + 1),0) as count from banners b inner join domains on b.did=domains.id where domains.domain like 'domain.com'; How to do it, thanks for any help! Thanks, With best regards, Gorohov Dmitry ---------------------------------------------- Contact information: MSN: [EMAIL PROTECTED] AOL: chrislee943 ICQ: 284144732 phone: +(10) 375 29 5680605 ---------------------------------------------- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]