Intersection with MySQL with queries -


I am trying to repeat two queries in MySQL in this query:

  SELECT user_id FROM post group select thread_ID HAVING COUNT (thread_ID) = 1 intersect from user_id from user_id; Group post (user_id) = 1 since URI_ID;   

I've discovered ways to do this in MySQL, but unfortunately I did not work for me using IN and INNER JOIN.

I have to work with test data:

  Post post (post_member, timestamp, user_id, thread_id) value (0,0,1,1000); Post in post (post_member, timestamp, user_id, thread_id) value (0, 02, 2000); Post in post (post_member, timestamp, user_id, thread_id) value (0,0,3,2000); Post in post (post_member, timestamp, user_id, thread_id) value (0,04,3000); Post in post (post_member, timestamp, user_id, thread_id) value (0,0,5,4000); Post in post (post_member, timestamp, user_id, thread_id) value (0,0,1,4000);   

To run the spacing of two of my questions

  4   

Any help is appreciated Thank you.

In postgres I will like it

  SELECT user_id by post Where Thread_ID (Thread_ID by Thread_ID) Select Thread_ID from post group by thread_id (c) = 1) Select intersect; URI post (user_id) = 1 by URI_ID from user_id; However, apparently, mysql does not support intersection, so an internal would be sufficient:  
  SELECT post.user_id to join the post From (SELECT user_id FROM, user_id with user_id by user_id = 1) x x.user_id = post.user_id where in thread post by thread_id (select thread_id if thread_id is counted (specific user_id) = 1)   

Both of those return 4

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -