From: Krasimir A. <ka2...@ya...> - 2004-11-01 12:21:03
|
Hi, I interested to see the generated SQL code from HaskellDB. The first step was to write very simple example: import Database.HaskellDB import Database.HaskellDB.Query import Database.HaskellDB.Sql import Database.HaskellDB.GenericConnect import Text.PrettyPrint import Testdb.Documents main = do let primQuery = runQuery $ do docs <- table documents project (docDate << docs!docDate) putStrLn (render (ppSql (toSql primQuery))) When the example was executed I got: SELECT DISTINCT docDate2 as docDate FROM (SELECT DISTINCT docDate1 as docDate2, id1, docDate1, creationDate1 FROM (SELECT DISTINCT id as id1, docDate as docDate1, creationDate as creationDate1 FROM documents as T1) as T1) as T1 I am surprised from this very complicated and inefficient code. What is the reason to have these nested "DISTICT" statements? I expected to see just something like: select docDate from documents Regards, Krasimir __________________________________ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com |