I had to use left join as the player does not always have equipment! I was printing out the query with getSQL and forgot to update the original sorry!
On Monday, January 7, 2013 9:01:32 AM UTC, Lukas Eder wrote: > > Hello, > >> I would like to select all equipment by player id so select the result from >> the player table and then get the equipment. I tried: >> >> >> String record = >> create.select().from(PLAYERS).join(EQUIPMENT).on(PLAYERS.ID.equal(EQUIPMENT.PLAYER_ID)).where(PLAYERS.USERNAME.equal(player.getName())).fetchOne(); >> >> > What you want to do is use "fetch()" instead of "fetchOne()", as you're > probably selecting from a one-to-many relationship. Besides, you cannot > assign this to "String record". You will want to assign any of the > following: > > - Record record = create.select().fetchOne(); > - Result<?> result = create.select().fetch(); > >> However this did not work! How do I go about doing this and also how do I >> iterate over the equipment once I have it? >> >> Please consider the tutorial. It includes an iteration example: > http://www.jooq.org/tutorial.php > > Cheers > Lukas >
