We present a quantum protocol for the solution of a two-party comparison task with the help of a semi-honest third party, which can be used to solve the millionaire problem. The secrets are coded into the phases of d-level entangled states by local operations and read by the third party's collective measurements. The two parties can deduce the results of comparisons based on the secret bits shared between them beforehand and the announcement of the third party. Moreover, others will learn no information of the comparison results, even the third party. Our scheme is private and fair, and the security has also been discussed.