Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT min(t1.id) as refer, t1.parent_id, t1.user_id as us_id, t2.cnt
- FROM modxev_programm_one as t1
- LEFT JOIN
- (
- SELECT parent_id, COUNT(parent_id) as cnt
- FROM modxev_programm_one
- WHERE parent_id is not null
- GROUP BY parent_id
- ) as t2
- ON t1.id = t2.parent_id
- WHERE t2.cnt > 0 and t2.cnt < 2
Add Comment
Please, Sign In to add comment