Fixed sql code to link the ticket_notes and the tickets tables.