mysql - Order by a column in another table -


i have 2 mysql tables:

web_forums_threads | tid | title     | |=================| | 1   | news post |  web_forums_posts | pid | tid | content  | date_created   | date_modified     | |===========================================================| | 1   | 1   | today,.. | unix timestamp | null or timestamp | | 2   | 1   | agree! | unix timestamp | null or timestamp | 

i want select * web_forums_threads, , order recent date_created value web_forums_posts correct corresponding tid.

i feel though results i've found google may incorrect case, because multiple rows can exist threads' tid.

the example tried (with no success): select * web_forums_threads fid = :postfid order (select date_created web_forums_posts web_forum_posts.tid = web_forums_threads.tid) desc;

the syntax might wrong concept there. don't want add column threads table because i'd storing info twice (the first post acts threads content).

you have make join between 2 tables

select * web_forums_threads wft, web_forums_posts wfp  wft.tid=wfp.tid  order wfp.date_created  

it that


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -