skip to Main Content

Mysql – Rails Multiple join query

I have the below Model structure class Transaction belongs_to :company belongs_to :user end class Company belongs_to :address end class User belongs_to :address end classAddress has_many :companies has_many :users end I want to query all transactions and get both company address…

VIEW QUESTION

MySQL Joining same table multiple times makes count go weird

Edited to clarify and simplify I have the following query select Signups.user_id, Count(timeoutTable.user_id) as timeoutCount, Count(confirmedTable.user_id) as confirmedCount from Signups left join ( select * from Confirmations where action = 'timeout' ) as timeoutTable on signups.user_id = timeoutTable.user_id left join…

VIEW QUESTION
Back To Top
Search