Hi Jeremy,
Table TEST
NAME A_DATE B_DATE C_DATE
----------------------------------------------------
JOE 1/1/2009 1/1/2010 1/1/2011
TOM 2/1/2010 3/1/2009 5/1/2016
----------------------------------------------------
class Test < Sequel::Model
dataset_module do
def toms
where(:name => 'TOM')
end
end
end
this is where I got stuck now.
I want to unpivot on those 3 date columns from the result set (Test.toms).
So the expected result set would become
NAME DATES SOURCE
----------------------------------------------------
TOM 2/1/2010 A_DATE
TOM 3/1/2009 B_DATE
TOM 5/1/2016 C_DATE
----------------------------------------------------
Thank you for your help.
Kenneth
On Wednesday, June 20, 2018 at 6:52:00 AM UTC-7, Jeremy Evans wrote:
>
> On Tuesday, June 19, 2018 at 10:27:01 PM UTC-7, lkfken wrote:
>>
>> Hi,
>>
>> I have a dataset method (dataset_module) which I want to modify the
>> result set so some columns would become rows by using UNPIVOT (mssql 2012)
>>
>> I searched but I don't think UNPIVOT is supported in Sequel.
>>
>> Using raw SQL is my next idea but I do not know how to make it work with
>> the Sequel::Dataset
>>
>> Please advise. Thank you.
>>
>
> If you post the SQL you want to use, then I can probably help you with the
> Sequel part.
>
> Thanks,
> Jeremy
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.