Hello Marko, Be careful when mixing "plain SQL" with "field and table name constructors". When using "plain SQL", the SQL string you provide jOOQ's API methods with, will be rendered as such. fieldByName on the other hand, will render reference literals, which might be put in double quotes, depending on your rendering settings.
See this section of the manual for proper usage of fieldByName() and tableByName(): http://www.jooq.org/doc/2.6/manual/getting-started/use-cases/jooq-as-a-standalone-sql-builder/ If you want to select "plain SQL" fields, you may be better off using any of the various "plain SQL field constructors": http://www.jooq.org/javadoc/latest/org/jooq/impl/Factory.html#field(java.lang.String) Cheers Lukas 2012/11/2 Marko Frelih <[email protected]> > SOLVED: I used Factory.fieldByName method: > >> Factory create=new >> Factory(CDatabaseManager.dbConnection(), >> SQLDialect.MYSQL); >> >> Result<Record>r=create.select(Factory.fieldByName("ha_mmContent", "Name"), >> Factory.fieldByName("ha_mmExt", "ExtName"), >> Factory.fieldByName("ha_mmTypes", "TypeName")). >> >> from("ha_mmContent"). >> >> join("ha_mmLinkTable").on("ha_mmContent.ID=ha_mmLinkTable.IDContent"). >> >> join("ha_mmExt").on("ha_mmLinkTable.IDExtension=ha_mmExt.ID"). >> >> join("ha_mmTypes").on("ha_mmLinkTable.IDType=ha_mmTypes.ID"). >> where("ha_mmContent.isActive=1").fetch(); >> > > On Friday, November 2, 2012 12:42:06 PM UTC+1, Marko Frelih wrote: >> >> Dear Sirs and Madams! >> >> I am newbie at jooq and in my project I've bypassed code generation of my >> db schema and I have following statement, which works perfectly: >> >>> Factory create=new Factory(CDatabaseManager.**dbConnection(), >>> SQLDialect.MYSQL); >>> Result<Record> r=create.select().from("ha_**mmContent"). >>> join("ha_mmLinkTable").on("ha_**mmContent.ID=ha_mmLinkTable.** >>> IDContent"). >>> join("ha_mmExt").on("ha_**mmLinkTable.IDExtension=ha_** >>> mmExt.ID"). >>> join("ha_mmTypes").on("ha_**mmLinkTable.IDType=ha_mmTypes.** >>> ID"). >>> where("ha_mmContent.isActive=**1").fetch(); >>> for(int iIndex=0; iIndex<r.size(); iIndex++) >>> { >>> System.out.println(iIndex); >>> //results.add(r.**getValuesAsString(iIndex).**toString()); >>> } // for >>> >> Now, the upper select gets me all fields of joined tables. How do I >> specify in .select() part of statement, which fields to retreive? >> >> Sincerely, >> Marko >> >
