Forum: Ruby Couting coumn and get a specifiq record?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7a00759a160167e20768ac7997b05314?d=identicon&s=25 Robert Mike (robert09)
on 2014-03-26 17:52
Hi
suppose i have a table like this

Name math English Science
Jim  90     33      33
Mike 77     40      40
Mike 80     50      90

how will i count :-

1) how many column this table has ?
2)  what the score for Mark in English ?




  any sample code or web link related to this would be greatfull.
249c7fd851c5c5ac5a1abdb756472ae1?d=identicon&s=25 Arup Rakshit (my-ruby)
on 2014-03-27 16:53
Robert Mike wrote in post #1141101:

>
> how will i count :-
>
> 1) how many column this table has ?
> 2)  what the score for Mark in English ?
>

Do you have it in CSV format ?
7a00759a160167e20768ac7997b05314?d=identicon&s=25 Robert Mike (robert09)
on 2014-03-28 22:33
Hi
no, its coming from sql query .

but i cant do column count from sql query.
i need to do this from  my ruby script

please advise.
249c7fd851c5c5ac5a1abdb756472ae1?d=identicon&s=25 Arup Rakshit (my-ruby)
on 2014-03-29 07:17
Robert Mike wrote in post #1141377:
> Hi
> no, its coming from sql query .
>
> but i cant do column count from sql query.
> i need to do this from  my ruby script
>
> please advise.

I understand. Do you saving the result of the sql query in any place ?
May be show us how are you fetching the result.
This topic is locked and can not be replied to.