Link to home
Start Free TrialLog in
Avatar of traport
traport

asked on

SQL Group BY - need help with syntax/usability & ColdfFusion

I have a query:

<cfquery name="qry_getEdQueue" datasource="#request.DSN#">
SELECT 

    	DISTINCT tblActivities.activityID
        , tblActivities.activityApprovedDate 
        , tblActivityAuthors.personID 
        , tblActivityAuthors.resumeDisplay
        , tblPerson.personType 
  		, tblPerson.personLast 
        , tblPerson_RTIDetail.personUnit  
        , tblCitations.citationFull 
        , lutblActivityResumeStatus.activityResumeStatus 
        
    FROM tblActivities 
    
    		JOIN tblActivityAuthors ON tblActivities.activityID = tblActivityAuthors.activityID    
    		JOIN tblPerson ON tblActivityAuthors.personID = tblPerson.personID 
            JOIN tblPerson_RTIDetail ON tblPerson_RTIDetail.personRTIID = tblPerson.personRTIID 
            JOIN tblCitations ON tblActivityAuthors.activityID = tblCitations.activityID 
            LEFT JOIN lutblActivityResumeStatus ON lutblActivityResumeStatus.activityResumeStatusID = tblActivityAuthors.activityResumeStatus 
    
    	WHERE activityProcessingStatus = '12' 
        AND tblActivityAuthors.resumeDisplay = '1'  
        <!--- do not include non-RTI Authors or Groups which are lutblPersonTypes LT 4 --->
        AND tblPerson.personType < 4 
        <!--- place units to look for with Editor Admin here --->
        
        ORDER BY tblPerson_RTIDetail.personUnit, tblPerson.personLast 
        
</cfquery>

Open in new window


which produces these results:

 User generated image
I don't know if it's possible, but I'd like to group the results by personLast so I could produce rows of data like this:

 User generated image
that only list the personUnit once, then the personID multiple times with their information.

I hope this makes sense. I doubt it does! Feel free to ask!
ASKER CERTIFIED SOLUTION
Avatar of cfEngineers
cfEngineers

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of traport
traport

ASKER

Genius! Many thanks.
Any Time