Tag Archives: mysql

Find user’s most recent post in each thread

One common problem that my sequence method can help to solve is how to display the most recent entry that a user has made in each thread that the user has contributed to: SELECT * FROM posts WHERE usedid = $userid AND postid IN (SELECT t1.postid, COUNT(t1.postid) AS sequence, t1.postid <= t2.postid AS flg FROM [...]
Posted in SQL Tips n Tricks | Also tagged , , , | 1 Comment

How to Sequence each Sub-set of Records

How to find/display/keep/delete the first/last n posts/records/entries for each user by using a sequence.
Posted in SQL Tips n Tricks | Also tagged , , , | 2 Comments