Section

SQL GELO

Jun 13th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.42 KB | None | 0 0
  1. SELECT
  2.     topic_id,
  3.     topic_subject,
  4.     user_name,
  5.     topic_date,
  6.     (select user_name from users, posts where post_by=user_id and post_topic= 'catid' ORDER BY post_date DESC LIMIT 1) AS 'Last Poster',
  7.     (select post_date from users, posts where post_by=user_id and post_topic= 'catid' ORDER BY post_date DESC LIMIT 1) AS 'Last Time'  
  8.    
  9. FROM
  10.     users, topics
  11.  
  12. WHERE
  13.     cat_id = 'catid' AND users.user_id = topics.topic_by
Advertisement
Add Comment
Please, Sign In to add comment