PDA

View Full Version : Recursive execs on a QSqlQuery



Patze
27th March 2009, 09:55
Hi everybody

is it possible to do recursive sql command executions on a QSqlQuery like this:

subset A = SELECT * FROM some_table WHERE type_id = magic_number

afterwards do another selection but on subset A like this (non valid syntax ;) )

SELECT * FROM subset A WHERE something


Thanks for help!

Hiker Hauk
27th March 2009, 10:26
Why not just

SELECT * FROM (SELECT * FROM some_table WHERE type_id = magic_number) WHERE something

Sql query is to query the database. After the first query you get a result set, which is not a datebase. You cannot run another sql query on the result set. You have to write code to loop through it.

Patze
27th March 2009, 11:27
Thank you! That's a great idea. :)