Thanks for your comment but I am NOT looking for the answer to the question: "Which SQL command will return requested pivot table"(anyway it will be an OFF TOPIC question here). My SQL SELECT statement works fine with Firebird 1.5! What I am looking how to generate this SELECT using Python. Anyway thanks for tyring to help :)