Advertisement
Guest User

Untitled

a guest
Feb 26th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. id BranchId Email Mobile StudentId
  2. 9497 25 mpsuraj2016@gmail.com 8700698773 25
  3. 9498 25 m016@gmail.com 8700698776 26
  4.  
  5. id like_count student_id
  6. 1 25 27
  7.  
  8. id student_id
  9. 1 9497
  10. 2 9497
  11. 3 9497
  12.  
  13. id visitor_count student_id
  14. 1 4 23
  15.  
  16. id student_id
  17. 1 67
  18.  
  19. id student_id rel_email rel_mobile
  20. 1 9497 kushwahji@gmail.com 9009859691
  21. 2 9497 kushwah@gmail.com 7566403326
  22. 3 9497 kushwah@gmail.com 1236403326
  23. 4 9497 suraj@gmail.com 123640332
  24.  
  25. id student_id Received
  26. 1 9497 7500
  27. 2 9497 3000
  28. 3 9497 3000
  29.  
  30. SELECT A.id as student_id,
  31. COUNT(DISTINCT B.id) as images,
  32. COUNT(DISTINCT C.id)+ COUNT(DISTINCT D.visitor_count) as visits,
  33. count(DISTINCT E.id) + SUM(B.like_count) as likes,
  34. COUNT(DISTINCT A.Email)+COUNT(DISTINCT F.rel_email) as emails,
  35. COUNT(DISTINCT A.Mobile)+COUNT(DISTINCT F.rel_mobile) as moibles,
  36. SUM(G.Received) as Received
  37. FROM mpkids_students AS A
  38. LEFT JOIN mpkids_student_image_gallery AS B ON B.student_id = A.id
  39. LEFT JOIN mpkids_visitors AS C ON C.student_id = A.id
  40. LEFT JOIN mpkids_visitors_count AS D ON D.student_id = A.id
  41. LEFT JOIN mpkids_image_likes AS E ON E.student_id = A.id
  42. LEFT JOIN mpkids_relatives_data AS F ON F.student_id = A.id
  43. LEFT JOIN mpkids_paidstatus AS G ON G.student_id = A.id
  44. WHERE A.BranchId = 25
  45. GROUP BY A.id
  46. ORDER BY A.StudentId DESC
  47.  
  48. student_id images visits likes emails moibles Received
  49. 9497 0 3 NULL 4 5 202500
  50. 9498 0 0 NULL 1 1 NULL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement