AnsweredAssumed Answered

ExecuteSQL: Selecting one of duplicate IDs

Question asked by jbrown Expert on Feb 7, 2013
Latest reply on Feb 8, 2013 by greglane

Hey all.

I have an executeSQL statement that is pulling a list of student IDs and Consequences from a detention table. Here's what it is pulling:




This one student has two different consequences, but i really only need the first one to be selected to put on a list. Some students have two of the same consequence, which looks like this:




How do I structure the SQL statement to only select the ACP consequence in the first example as well as only one of the 2nd example? I realize the SELECT DISTINCT would pull only one of the 2nd example, but it would pull BOTH of the 1st example since they are technically different rows.


Here's the sql statement:

Let (TodaysDate = Get(CurrentDate);




SELECT fk_StudentID, EventType

FROM BehaviorTable

WHERE EventDate =?

AND School =?

ORDER BY fk_StudentID, EventType";






Thanks for your advise.