Revert "fixed the order of select statement"

This reverts commit 26695ada97f417cc1cb8d84f330736e6d1a1ff78.
Revert "fixed the doctest"

This reverts commit 1462c7b331f776f7ee5701b73269f384ee0fd80a.