Quantcast
Channel: General developer forum
Viewing all articles
Browse latest Browse all 37673

Re: Useful SQL Queries?

$
0
0
by Davo Smith.  

JoseRey - off the top of my head:

SELECT u.id, u.firstname, u.lastname, u.email
FROM mdl_user u
JOIN (SELECT userid, COUNT(*) c
FROM mdl_user_enrolments
GROUP BY userid)  ue ON ue.userid = u.id
WHERE ue.c = 1

Probably some typos in there and I haven't got access to a database to try it right now, but should be a good starting point.


Viewing all articles
Browse latest Browse all 37673

Trending Articles