Skip to content

Instantly share code, notes, and snippets.

@mikevalstar
Created May 23, 2011 15:49
Show Gist options
  • Save mikevalstar/986922 to your computer and use it in GitHub Desktop.
Save mikevalstar/986922 to your computer and use it in GitHub Desktop.
SELECT SQL_CALC_FOUND_ROWS
`group_user`.*,
concat(`name_first`, ' ', `name_last`) as `full_name`,
`name_first`,
`name_last`,
`gender`,
`email`,
`img`,
`country`,
`place`,
`pro_background`,
`description` as lu_description,
`group_update`.`created_when` as lu_when,
`group_update`.title as lu_title,
`group_update`.`id_group` as lu_id_group,
`group_update`.`id_group_update` as lu_id
FROM `group_user`, `user`
LEFT JOIN `group_update` ON `group_update`.`created_by` = `user`.`id_user`
AND `id_group_update` = (SELECT `id_group_update`
FROM `group_update`
WHERE `created_by` = `user`.`id_user` AND `group_user`.`id_group` = `group_update`.`id_group`
ORDER BY `created_when` DESC LIMIT 0,1)
WHERE `user`.`id_user` = `group_user`.`id_user` AND `group_user`.`id_group` = ? AND {$search}
ORDER BY {$orderby}
LIMIT ".$start.','.$count;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment