We use generating functions to express orthogonality relations in the form of q-beta. integrals. The integrand of such a q-beta. integral is then used as a weight function for a new set of orthogonal or biorthogonal functions. This method is applied to the continuous q-Hermite polynomials, the Al-Salam-Carlitz polynomials, and the polynomials of Szegö and leads naturally to the Al-Salam-Chihara polynomials then to the Askey-Wilson polynomials, the big q-Jacobi polynomials and the biorthogonal rational functions of Al-Salam and Verma, and some recent biorthogonal functions of Al-Salam and Ismail.