Hi Jeremy,
is it possible to modify the sql statment in the Dataset object, so I could
get rid of that comma? Thanks.
On Thursday, July 12, 2018 at 12:50:54 PM UTC-7, Jeremy Evans wrote:
>
> On Thursday, July 12, 2018 at 12:32:10 PM UTC-7, lkfken wrote:
>>
>> Hi Jeremy,
>>
>> I tried but it's n
Thank you Jeremy for the quick response.
I did came up with a dump solution
...
def db
dataset.db
end
def exec
sequel = db.select(*columns).from(dataset, Sequel.lit("UNPIVOT (#{name} FOR
#{names} IN (#{unpiv_columns}))").as(:p2))
stmt = sequel.sql
db.fetch(stmt.gsub(', UNPIVOT', ' UN
On Thursday, July 12, 2018 at 12:32:10 PM UTC-7, lkfken wrote:
>
> Hi Jeremy,
>
> I tried but it's not working
>
> MSSQL raise an error "Incorrect syntax near the keyword 'UNPIVOT'".
>
> It is because a "comma", right after the alias "p1" and before the
> operator UNPIVOT, is found in the SQL stat
Hi Jeremy,
I tried but it's not working
MSSQL raise an error "Incorrect syntax near the keyword 'UNPIVOT'".
It is because a "comma", right after the alias "p1" and before the operator
UNPIVOT, is found in the SQL statement
Please advise. thank you.
Kenneth
On Thursday, June 21, 2018 at 12:25
On Thursday, June 21, 2018 at 10:41:52 AM UTC-7, lkfken wrote:
>
> Hi Jeremy,
>
> Sorry about that. I misunderstood on what you need.
>
> Here is the SQL statement
> SELECT NAME,
>dates,
>source
> FROM (SELECT NAME,
>a_date,
>b_date,
>
Hi Jeremy,
Sorry about that. I misunderstood on what you need.
Here is the SQL statement
SELECT NAME,
dates,
source
FROM (SELECT NAME,
a_date,
b_date,
c_date
FROM test
WHERE NAME = 'TOM') AS p1
UNPIVO
On Wednesday, June 20, 2018 at 10:23:02 AM UTC-7, lkfken wrote:
>
> Hi Jeremy,
>
> Table TEST
>
> NAME A_DATE B_DATE C_DATE
>
> JOE1/1/2009 1/1/2010 1/1/2011
> TOM 2/1/2010 3/1/2009 5/1/2016
> -
Hi Jeremy,
Table TEST
NAME A_DATE B_DATE C_DATE
JOE1/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(
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