From: Matthias R. <mat...@so...> - 2006-07-11 21:38:17
|
I am trying to construct a haskelldb query that returns the count of the ids in one table that are not present in another table. Here's what I came up with: test1Query = do t <- table Table1.table1 project (idField << t1!Table1.xid) test2Query = do t <- table Table2.table2 project (idField << t2!Table2.xid) test3Query = do ids <- minus test1Query test2Query project (countField << count (ids!idField)) Unfortunately this is not producing the right SQL. showSql returns (SELECT DISTINCT COUNT(id) as count FROM table1 as T1) EXCEPT (SELECT DISTINCT COUNT(id) as count FROM table2 as T1) The same happens for other combinations of relational operations with aggregate expressions, e.g. 'union' combined with '_min'. In all cases the aggregate expression gets pushed under the relational operation, which is just plain wrong. Am I not constructing my queries the right way or is this a bug? Matthias. PS: Is the haskelldb bug tracker at http://sourceforge.net/tracker/?group_id=101095&atid=629040 still in use? There hasn't been any activity on it for nearly 18 months. |