SELECT Wi.ReferenceNumber AS workflowinstancereference, Ard.ApplicationNumber
FROM App.ApplicationDetails Ard
	INNER JOIN Wf.WorkflowInstances Wi ON Ard.WorkflowInstanceID = Wi.WorkflowInstanceID
WHERE  Ard.ApplicationDetailID = [[applicationdetailid]]