On Wednesday, March 26, 2014 11:32:16 AM UTC-7, Hillary wrote:
>
> So i'm translating an existing sql query to sequel.
>
> the sql query has the following join 
>
> inner join Catalog_Hierarchy_Level as CHL
> on CHL.Catalog_ID = @catalog_id
> and CHL.Hierarchy_Function_ID = CHF.Hierarchy_Function_ID
> and ISNULL(CHL.Parent_Hierarchy_Level_Code, 0) = 
> CH12.Parent_Hierarchy_Level_Code
>
> i've got the first two parts of this join, but i'm stuck on how to 
> translate the line in red to sequel. 
>
>
> I tried to use Sequel.literal and i got an error unexpected ')' expecting 
> tASSOC
>
> inner_join(:catalog_hierarchy_level___chl, :chl__catalog_id => catalog_id, 
> :chl__catalog_hierarchy_function_id => :chf__hierarchy_function_id, 
> Sequel.literal('ISNULL(CHL.Parent_Hierarchy_Level_Code, 0) = 
> CH12.Parent_Hierarchy_Level_Code')).
>

That's not valid ruby syntax.  You should be able to do:

 inner_join(:catalog_hierarchy_level___chl, :chl__catalog_id => catalog_id, 
:chl__catalog_hierarchy_function_id => :chf__hierarchy_function_id, 
Sequel.function(:ISNULL, :CHL__Parent_Hierarchy_Level_Code, 0) => 
:CH12__Parent_Hierarchy_Level_Code)

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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to