public DataSet getGodmotherStatusByShift(string statustocheck, string orderby, string shiftID)
{
string sql = "Select transID, FairyGodmotherTimestamp.fairyGodmotherID, n.Name, FairyGodmotherTimestamp.timestamp, FairyGodmotherTimestamp.status, b.shiftID From FairyGodmotherTimestamp, (Select ID, lastname + ', ' + firstname AS Name FROM FairyGodmother) n, (Select fairyGodmotherID, shiftID From FairyGodmotherShift) b, (Select fairyGodmotherID, max(timestamp) as TimeStamp FROM FairyGodmotherTimestamp Group BY fairyGodmotherID) a Where a.fairyGodmotherID= FairyGodmotherTimestamp.fairyGodmotherID and a.timestamp= FairyGodmotherTimestamp.timestamp and n.ID= fairyGodmotherTimestamp.fairyGodmotherID and b.fairyGodmotherID = FairyGodmotherTimestamp.fairyGodmotherID and FairyGodmotherTimestamp.status = '";
sql += statustocheck + "' and b.shiftID =" + shiftID + " Order By " + orderby;
return database.getDataSet(sql, "tableName");
}