Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9289843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:16:38+00:00 2026-06-18T20:16:38+00:00

Based on a table employees , I created a view in my MySQL database

  • 0

Based on a table employees, I created a view in my MySQL database called Employees_by_gender:

select count(gender_id) AS "Number of Employees",gender_id AS "Gender" from employees group by gender_id;

mysql> select * from Employee_by_gender;
+--------+---------------------+
| Gender | Number of Employees |
+--------+---------------------+
|      1 |                3890 |
|      2 |                1087 |
+--------+---------------------+

How do I render the output of this database view in a client side table? I’ve been using “dataTables bootstrap rails” for all my normal tables rendering.

Screenshot of table

How can I get this data in a table-like display?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T20:16:39+00:00Added an answer on June 18, 2026 at 8:16 pm

    I’m not sure on the specifics of dataTables, but you can create an ActiveRecord model for the view as if it were a normal (read-only) table:

    class EmployeesByGender < ActiveRecord::Base
      self.table_name 'Employees_by_gender'
    end
    

    However, you are going to have a very hard time unless you rename your view column names to not contain spaces.

    If you must keep the spaces in the column names, follow the advise here:

    https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.ruby/SNZNQu_h92w

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a heap based table in MySQL that I am trying to update
I want to grab records from a table based on the day of the
I have a form which writes to a MySQL database. For example: Employee Number:
Hi i have table in database call Employees Employees ------------- id|Name|Pwd|Isblocked 1|anil|anil| what i
Hi I have a datatables based table that holds data. I need to be
In the programming of a table-based application module (i.e. the user mostly enters tabular
I'm trying to update one table based on values in another table. What's wrong
I'm replacing all Fireworks-generated table-based rollovers on my site with CSS rollovers; I've so
I have a stored procedure which update a table based on such calculation and
I'm scraping a website that's mostly table based. I have <tr> tags that each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.