Ah, got you.

I achieved the same result using something like this:

Select select = new Select(getDatasource())
               .from("question_answer, answer, question")
               .distinct()
                      .field("question.id QuestionID")
                       .field("question.qText Question")
                       .field("answer.id AnswerID")
                       .field("answer.text Answer")
                       .field("question_answer.correct_answer CorrectA")
               .where( "answer.id = answer_id")
               .whereAnd("question_id = ?")
               .whereAnd("question.id = question_id");

thanks.

J.


On 9/25/06, Geert Bevin <[EMAIL PROTECTED]> wrote:
Hi John,

MySQL simply doesn't support it, only DISTINCT (without on) is
supported:
http://dev.mysql.com/doc/refman/4.1/en/select.html

Best regards,

Geert

On 25 Sep 2006, at 01:02, John Lukar wrote:

> Hi folks,
> is it true that distinctOn is not supported by MySql JDBC driver  ?  I
> have tried both versions:
>
> mysql-connector-java-5.0.3
> mysql-connector-java-3.1.13
>
> on MySql versions:
>
> 4.1.10a-nt
> 5.0.22-Debian_0ubuntu6.06.2-log
>
> and all the same results.
>
> below is the SQL:
>
>
> Select select = new Select(getDatasource())
>                .distinctOn("question.id QuestionID, question.qText
> Question, answer.id AnswerID, answer.text Answer,
> question_answer.correct_answer CorrectA")
>                .from("question_answer")
>                .from("answer")
>                .from("question")
>                .where( "answer.id = answer_id")
>                .whereAnd("question_id = 3")
>                .whereAnd("question.id = question_id");
>
>
>        System.out.println(" Query: "+select.getSql());
>
>        // fetch every row in the resultset and forward the processing
>        // of the data to the DisplayProcessor
>        executeFetchAll(select, processor);
>
>
> Below is the stack trace:
>
>
> om.uwyn.rife.database.exceptions.UnsupportedSqlFeatureException: The
> 'DISTINCT ON' feature isn't supported by the driver
> 'com.mysql.jdbc.Driver'.
>       at com.uwyn.rife.database.queries.Select.getSql(Select.java:291)
>       at com.uwyn.ecalendar.ExamQuestionManager.display
> (ExamQuestionManager.java:56)
>       at com.uwyn.ecalendar.elements.DisplayExamQuestions.processElement
> (DisplayExamQuestions.java:56)
>       at com.uwyn.rife.engine.ElementContext.processContext
> (ElementContext.java:443)
>       at com.uwyn.rife.engine.RequestState.service(RequestState.java:342)
>       at com.uwyn.rife.engine.Gate.handleRequest(Gate.java:421)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:585)
>       at com.uwyn.rife.servlet.RifeFilter.doFilter(RifeFilter.java:142)
>       at org.mortbay.jetty.servlet.WebApplicationHandler
> $CachedChain.doFilter(WebApplicationHandler.java:823)
>       at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch
> (WebApplicationHandler.java:473)
>       at org.mortbay.jetty.servlet.ServletHandler.handle
> (ServletHandler.java:567)
>       at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
>       at org.mortbay.jetty.servlet.WebApplicationContext.handle
> (WebApplicationContext.java:635)
>       at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
>       at org.mortbay.http.HttpServer.service(HttpServer.java:954)
>       at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> _______________________________________________
> Rife-users mailing list
> [email protected]
> http://lists.uwyn.com/mailman/listinfo/rife-users
>

--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to