Level 27
@bufferoverflow having doesn't allow comparing two columns, the second (or third) parameter is meant to be a value (e.g. having('emails_count', '<', 100)). Right know you are checking if the email count is lesser than the string "available_replies". You can use havingRaw to achieve what you want.
havingRaw('emails_count < available_replies')
1 like