Hi, I want to display both terminal_id and user_id. If i try to echo by using p i.e p @list It is displaying only terminal_id. Please help me to correct my query. @list = NetworkTerminal.find(:all, :select => "network_terminals.terminal_id,timings.user_id", :joins => "LEFT JOIN timings ON network_terminals.terminal_id timings.terminal_id", :conditions => {:network_id => ''net343''} ) Thanks, -- Posted via http://www.ruby-forum.com/.
Venkat Eee wrote:> Hi, > > I want to display both terminal_id and user_id.[...] Where is user_id supposed to come from? It''s not clear from looking at your query. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
On May 28, 10:14 am, Venkat Eee <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > I want to display both terminal_id and user_id. If i try to echo by > using p i.e > p @list > It is displaying only terminal_id. Please help me to correct my query. >You''re going to have to do that your self - output foo.user_id and foo.terminal_id for each foo in your list. Fred> @list = NetworkTerminal.find(:all, > :select => "network_terminals.terminal_id,timings.user_id", > :joins => "LEFT JOIN timings ON network_terminals.terminal_id > timings.terminal_id", > :conditions => {:network_id => ''net343''} > ) > > Thanks, > -- > Posted viahttp://www.ruby-forum.com/.
Marnen Laibow-Koser wrote:> Venkat Eee wrote: >> Hi, >> >> I want to display both terminal_id and user_id. > [...] > > Where is user_id supposed to come from? It''s not clear from looking at > your query. > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.orgHi, user_id is a field in timings table. -- Posted via http://www.ruby-forum.com/.