Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- id BranchId Email Mobile StudentId
- 9497 25 mpsuraj2016@gmail.com 8700698773 25
- 9498 25 m016@gmail.com 8700698776 26
- id like_count student_id
- 1 25 27
- id student_id
- 1 9497
- 2 9497
- 3 9497
- id visitor_count student_id
- 1 4 23
- id student_id
- 1 67
- id student_id rel_email rel_mobile
- 1 9497 kushwahji@gmail.com 9009859691
- 2 9497 kushwah@gmail.com 7566403326
- 3 9497 kushwah@gmail.com 1236403326
- 4 9497 suraj@gmail.com 123640332
- id student_id Received
- 1 9497 7500
- 2 9497 3000
- 3 9497 3000
- SELECT A.id as student_id,
- COUNT(DISTINCT B.id) as images,
- COUNT(DISTINCT C.id)+ COUNT(DISTINCT D.visitor_count) as visits,
- count(DISTINCT E.id) + SUM(B.like_count) as likes,
- COUNT(DISTINCT A.Email)+COUNT(DISTINCT F.rel_email) as emails,
- COUNT(DISTINCT A.Mobile)+COUNT(DISTINCT F.rel_mobile) as moibles,
- SUM(G.Received) as Received
- FROM mpkids_students AS A
- LEFT JOIN mpkids_student_image_gallery AS B ON B.student_id = A.id
- LEFT JOIN mpkids_visitors AS C ON C.student_id = A.id
- LEFT JOIN mpkids_visitors_count AS D ON D.student_id = A.id
- LEFT JOIN mpkids_image_likes AS E ON E.student_id = A.id
- LEFT JOIN mpkids_relatives_data AS F ON F.student_id = A.id
- LEFT JOIN mpkids_paidstatus AS G ON G.student_id = A.id
- WHERE A.BranchId = 25
- GROUP BY A.id
- ORDER BY A.StudentId DESC
- student_id images visits likes emails moibles Received
- 9497 0 3 NULL 4 5 202500
- 9498 0 0 NULL 1 1 NULL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement