English 中文(简体)
消除间谍网,更新最近一行
原标题:SQL remove spam row, update most recent row
  • 时间:2012-05-04 09:21:14
  •  标签:
  • mysql
  • sql
  • row

我目前正在使用MySQL在PHP中提供公共参考指南。 有时会发生pa变,我想再回过上页。

所有版本的页面都储存起来,因此我的问题只是问问题。

UPDATE pages new, pages old SET new.status= 2 ,old.status= 1  WHERE new.ip= <spambotip>  AND new.status= 0  AND old.title=new.title AND old.status= 1  AND old.last_modified IN (SELECT max(last_modified) FROM pages tr WHERE tr.title = new.title AND tr.status= 0 )

However I get the following error:

您可以具体说明从条款中更新的新目标表。

我的问询是要找到所有页头,其地位为1页(活性),把该页的地位定在2页(丛林),然后找到最后一页,即:经修改的,同一标题和地位为0页(不活动),并确定该页的地位为1。

我认为,我需要利用内部通道,但我正在提出一些问题,设想如何做到这一点。 我ve一环,但却发现我可以使用的任何东西。

感谢任何帮助。

问题回答

编辑:

Dim sList as String  = ... SELECT group_concat(title) FROM pages WHERE ip= <spambotip> 

UPDATE pages  SET staus=2 where  title IN (...)

 UPDATE pages SET status=1 where id IN (SELECT id from (SELECT id,  max(last_modified) from pages where title in (...) and status=0 group by title) x )




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签