View Single Post
Old 11-16-2012, 01:38 PM   PM User | #5
Trki
Regular Coder

 
Join Date: Jan 2012
Location: Slovakia
Posts: 106
Thanks: 9
Thanked 0 Times in 0 Posts
Trki is an unknown quantity at this point
Okay ... here are my tables what i need ( i changed my problem so please forget on the previous (its similiar) but lets look at this problem ... how would u solved it? :P )

I have array with this ID of statuses (3398,3342,3129,2895,2157,2072,2062,1995,1945,1915) so i think we can use IN later...

Now i need withdraw all comments from comments table where comments.status_id are from this array with ids...

Then i need select from another table (where the users are) the profile_picture_ultra_small... and connect it with the comments nick names

what is important... its there can be a lot of statuses to one status id ... and just one picture to the nick of person who have commented on. So The tables looks like:

Users .. ( big but.. we need just one collum)



Comments table:



Any ideas? I have solution but is ultra slow....


I wrote hardly something like this

PHP Code:
SELECT c.*,tu.profile_picture_ultra_small
 FROM comments 
AS c
 LEFT JOIN users 
AS tu
  ON c
.nick tu.nick
 WHERE status_id IN 
(3398,3342,3129,2895,2157,2072,2062,1995,1945,1915
is that ok? it seems to be ... but .. hm

Last edited by Trki; 11-16-2012 at 03:31 PM..
Trki is offline   Reply With Quote