Hi Lukas:
Thanks for getting back to me so quickly!
Here is one variation of what I tried based on the documentation:
public void testUnion(DSLContext context) {
// String sql = "SELECT CONCAT(last_name,', ',first_name,' (home)') AS
name,home_email FROM attendees WHERE list = 1 UNION SELECT CONCAT(last_name,',
',first_name,' (work)') AS name,work_email FROM attendees WHERE list = 1";
Result<Record> context.selectFrom(ATTENDEES.HOME_EMAIL)
.union(context.selectFrom(ATTENDEES.WORK_EMAIL))
.fetch();
}
Passing in an instance of *DSLContext* has worked with other methods. And what
I failed to do was consider using *Record2<String,String>*.
I will have to a look...thanks!
Mike.
On Monday, November 27, 2017 at 3:18:53 AM UTC-5, Lukas Eder wrote:
>
> Hi Mike,
>
> Thanks for your message. What have you tried? Would you mind posting your
> jOOQ code as well?
>
> Essentially (just like in SQL), your two union subqueries must have
> exactly the same row type. In your case, that would correspond to
> Record2<String, String>
>
> Thanks,
> Lukas
>
> 2017-11-27 2:47 GMT+01:00 Michael Redlich <[email protected] <javascript:>>
> :
>
>> Hello:
>>
>> I'm still new to jOOQ. I'm trying to duplicate the following SQL
>> statement:
>>
>> String sql = "SELECT CONCAT(last_name,', ',first_name,' (home)') AS
>> name,home_email FROM attendees WHERE list = 1 UNION SELECT
>> CONCAT(last_name,', ',first_name,' (work)') AS name,work_email FROM
>> attendees WHERE list = 1";
>>
>> I've tried the *.union()* method in conjunction with *.selectFrom()* and
>> with *.select()* methods and still getting errors relative to types, etc..
>>
>> I would appreciate any help...thanks!
>>
>> Mike.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "jOOQ User Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.