User:Sj/questionsofdata

From Wikipedia, the free encyclopedia

See also http://meta.wikipedia.org/wiki/Requests_for_queries .

Q1: "Which articles have I started?"
Try the following, with a suitable JOIN and ORDER BY.

SELECT old_title as title, old_timestamp as time
FROM   old o1
WHERE  old_user = YOURUSERID
  AND  old_timestamp=(SELECT MAX(o2.old_timestamp)
        FROM old o2
        WHERE o1.old_title = o2.old_title);
SELECT cur_title as title, cur_timestamp as time
FROM   cur
WHERE  cur_user = YOURUSERID
  AND  cur_title NOT IN (SELECT DISTINCT title FROM old);

Q2: "Which articles was I last to edit?"

SELECT cur_title as title, cur_timestamp as time
FROM   cur
WHERE  cur_user = YOURUSERID