当前位置: 数据库>sqlserver
sql语句实例 取得日志条目的sql语句
来源: 互联网 发布时间:2014-08-29
本文导语: 取得日志条目的sql语句: 代码示例: SELECT user_name, log_namespace, ns_name, log_timestamp, log_action, log_title, log_comment FROM logging JOIN toolserver.namespace ON log_namespace = ns_id AND dbname = 'enwiki_p' JOIN `user` ON log_user = user_i...
取得日志条目的sql语句:
代码示例:
SELECT
user_name,
log_namespace,
ns_name,
log_timestamp,
log_action,
log_title,
log_comment
FROM logging
JOIN toolserver.namespace
ON log_namespace = ns_id
AND dbname = 'enwiki_p'
JOIN `user`
ON log_user = user_id
WHERE log_type='delete'
AND log_action != 'restore'
AND log_action != 'delete';
----edit by www.
user_name,
log_namespace,
ns_name,
log_timestamp,
log_action,
log_title,
log_comment
FROM logging
JOIN toolserver.namespace
ON log_namespace = ns_id
AND dbname = 'enwiki_p'
JOIN `user`
ON log_user = user_id
WHERE log_type='delete'
AND log_action != 'restore'
AND log_action != 'delete';
----edit by www.
说明:
以上语句中取得类型为delete但操作方式非restore或delete类型的日志。
其中,用到了join on语句,有兴趣的朋友,可以研究下。