Cinis Posted August 1, 2014 Report Share Posted August 1, 2014 posts tabula id | post_id | user_id | text -------------------------------- 1 | 0 | 1 | bla bla 2 | 0 | 2 | bla bla bla 3 | 1 | 5 | bla bla bla bla bla bla 4 | 0 | 6 | bla bla 5 | 2 | 5 | bla bla bla 6 | 0 | 2 | bla bla bla bla bla 7 | 0 | 1 | bla bla bla bla bla bla bla 8 | 0 | 4 | bla bla bla 9 | 0 | 4 | bla bla uzlikts, lai rādā visus ierakstus ORDER BY id DESC kā ir jāselekto, lai ja post_id ir vienāds ar mana posta id tad viņu nerāda, ja pieņemsim mans user_id = 1 un id = 1, gribu panākt, lai nerāda id = 3, jo viņa post_id = 1 (manu posta id) ceru, ka sapratāt, paldies jau iepriekš Quote Link to comment Share on other sites More sharing options...
draugz Posted August 1, 2014 Report Share Posted August 1, 2014 Varētu būt kaut kā šādi SELECT t1.* FROM tabula t1 LEFT OUTER JOIN t2 on t1.id = t2.post_Id ORDER BY t1.id DESC Quote Link to comment Share on other sites More sharing options...
jurchiks Posted August 1, 2014 Report Share Posted August 1, 2014 `post_id` kolonnas nosaukumam vajadzētu būt `parent_id`, jo `id` pēc būtības jau ir `post_id`. Ambiguous. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.