I am attaching the schema a full schema of my code there are three tables involved first one is messages and other one users and next one is message_replies these three table he I am trying to get the result of all messages using case and when query . I am attaching a link for schema :
https://gist.github.com/nwoow/998f353d3803dea2356c Have a look at the schema tell me if you need more On Friday, July 31, 2015 at 11:44:42 PM UTC+5:30, Urubatan wrote: > > the query is possible > > you need to show us your schema for a better answer (or at least the > parts of the schema that are involved in the question) > > and I'm having problems understanding what you write, there are no > commas, no points, no new lines, ... > Rodrigo Urubatan Ferreira Jardim > Architect, Developer and Technical Writer > urub...@gmail.com <javascript:> > Visite meu blog: http://www.urubatan.com.br > > Melhor livro de RoR do Brasil: http://livro.urubatan.com.br > > > On Fri, Jul 31, 2015 at 3:09 PM, Nilay Singh <li...@ruby-forum.com > <javascript:>> wrote: > > Fixing a schema is other thing this very straight forward question how > > can I generate the query which I am using in find_by_sql or is there any > > mechanism where I can select two tables without join and use the case > > and when . Or can you tell me how to right exact query where I can get > > the result like case when and then . > > > > -- > > Posted via http://www.ruby-forum.com/. > > > > -- > > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to rubyonrails-ta...@googlegroups.com <javascript:>. > > To post to this group, send email to rubyonra...@googlegroups.com > <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/82e6f23c602c4de49d4a87d2d27c6393%40ruby-forum.com. > > > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f7efa9be-7d5d-4114-8376-b00df20f54e2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.