Walter Meester
HoogkarspelNetherlands
General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
I was thinking about the general case where the complex Select structure includes redundant clauses. My example was overly simplified (and kind of dumb, as you pointed out :)
I'm joining the result of 4 multi-table Selections into a single file. Each select is grouped successively higher. In this case, it makes more sense to have:
Select * from Source, into cursor qcTable1 Group By lowest_group
Select * from qcTable1, into cursor qcTable2 Group By low_group
Select * from qcTable2, into cursor qcTable3 Group By mid_group
Select * from qcTable3, into cursor qcTable4 Group By high_group
Select * from qcTable1 Union;
`Select * from qcTable2 Union;
`Select * from qcTable3 Union;
`Select * from qcTable4 into cursor qcOutput
the actual code is far more cumbersome (about a screenful each Select)
By separating the job into 4 pieces that keep grouping off the previous result, the job is very fast. By comparison, i couldn't even figure out how to express this in one select statement.
(FYI, lowest_=6000, low_=1500, mid_=40, high_=13 records)
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only