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', ' UNPIVOT'))
end


...

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 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.
>>
>
> I see.  Unfortunately, you'll have to use raw SQL for this query: 
> DB["SELECT ..."]
>
> 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.

Reply via email to