SELECT COUNT(true) AS count, client_aggregate.*, property_aggregate.* FROM client_aggregate LEFT JOIN property_aggregate ON client_aggregate.client_property_id = property_aggregate.property_id WHERE property_aggregate.%s = :qid AND ( (client_aggregate.user_account_first_name ILIKE :client_first_name AND client_aggregate.user_account_last_name ILIKE :client_last_name) OR client_aggregate.address_line1 ILIKE :client_address_line1 OR client_aggregate.user_account_primary_phone = :client_primary_phone AND client_aggregate.client_is_primary = 1) ORDER BY user_account_register_timestamp ASC, property_aggregate.property_session_scheduled_time ASC LIMIT :limit OFFSET :offset