Tuesday, January 22, 2008

Best SQL Statements Ever or Joel is no Longer On-Call

Thanks to new Job I am no longer on call. For those of you techies who read my blog the sql statements below removed me from the on-call system!!

//Check to see what groups Joel is a member of
mysql> select g.name, g.groupID , u.username, u.userID from jiveGroup g, jiveGroupUser gu, jiveUser u where g.groupID = gu.groupID and gu.userID=u.userID and u.username='joel';
+---------------+---------+----------+--------+
| name | groupID | username | userID |
+---------------+---------+----------+--------+
| supportAgents | 4 | Joel | 3 |
| Jive Software | 100 | Joel | 3 |
+---------------+---------+----------+--------+
2 rows in set (0.09 sec)javascript:void(0)

//Remove Joel from the support on call group
mysql> delete from jiveGroupUser where groupID = 4 and userID = 3;
Query OK, 1 row affected (0.80 sec)

//Verify Joel is no longer a member
mysql> select g.name, g.groupID , u.username, u.userID from jiveGroup g, jiveGroupUser gu, jiveUser u where g.groupID = gu.groupID and gu.userID=u.userID and u.username='joel';
+---------------+---------+----------+--------+
| name | groupID | username | userID |
+---------------+---------+----------+--------+
| Jive Software | 100 | Joel | 3 |
+---------------+---------+----------+--------+
1 row in set (0.09 sec)

0 comments:

Post a Comment