Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- u.name AS source,
- u2.name AS target
- FROM
- board_posts AS p
- /* Get user data for the post */
- LEFT JOIN board_users AS u
- ON u.id = p.author_id
- /* Try to get user data for the user inside quotation marks */
- LEFT JOIN board_users AS u2
- ON u2.name = substring_index(
- substring_index(p.message, '[quote="', - 1),
- '"]',
- 1
- )
- /* CHAR(7) is the unicode I used to separate different previous names */
- OR LEFT(u2.other_names, LOCATE(CONCAT("", CHAR(7), ""), u2.other_names) - 1) = substring_index(substring_index(p.message, '[quote="', - 1), '"]', 1)
- WHERE
- LOWER(p.message) LIKE '[quote="%'
- ORDER BY
- p.id DESC
- LIMIT 50
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement