SELECT
  "stacks".*
FROM "stacks"
  INNER JOIN "apps"
    ON ("apps"."id" = "stacks"."app_id")
WHERE (((("user_id" = 1)
AND ("channel_id" IS NULL)))
AND ("apps"."properties" IS NULL))

Hi Jeremy,


In this query, *user_id* is ambiguous. It exists on both table. How can i 
make sure its targeted for stacks but not apps?

I use this method for multiple AND and ORs:
       
params = [{
            user_id: @user.id,
            channel_id: @channel.id,
          }]  
 params_or = [{
            user_id: @user.id,
            channel_id: nil,
          }]


And my ruby code is like:

Stacks.select { stacks.* }.join_table(:inner, :apps, id: :app_id)
          .where { (Sequel.&(*params)) | (Sequel.&(*params_or)) }
          .where { (apps[:properties] =~ nil) }

On this case I tried to append double underscore with table name but it 
didn't worked. (*stacks__user_id*)

Thanks!

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/9b67b04b-0fe8-43df-bc61-3177e770ab0d%40googlegroups.com.

Reply via email to