dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Bar chart with respect to Database

Hybrid View

  1. #1
    Join Date
    May 2012
    Posts
    9

    Bar chart with respect to Database

    Here is my DB(mysql):

    mysql> select * from user_management;
    +----------+--------+------------+--------+-----------+---------------+--------
    +------+--------+
    | emp_name | emp_id | mob_no | device | model | imei | os
    | grp | policy |
    +----------+--------+------------+--------+-----------+---------------+--------
    +------+--------+
    | Bramha | 007 | 9876543210 | APPLE | Galaxy | 75898789908 | 2.3.3
    | hr | C |
    | Dipankar | 10203 | 9988776655 | HTC | iPhone 3G | 692634894198 | Obj_C
    | tech | All |
    | Ami | 4307 | 1176543210 | HTC | Galaxy | 75898789908 | 2.3.3
    | hr | CUW |
    | Himanshu | 67890 | 9988776446 | NOKIA | 2.2 | 3756645767710 | Android
    | dev | CUBV |
    | Vivek | 789 | 9988776655 | APPLE | Apple 4G | 3756676767766 | 4G
    | hr | CU |
    | Bramha | 7892 | 9988776656 | APPLE | 2.3.3 | 3756645767766 | Android
    | tech | CU |
    +----------+--------+------------+--------+-----------+---------------+--------
    +------+--------+

    and on the basis of device name(APPLE,NOKIA,SAMSUNG) I want to create a bar chart which will show "no. of device VS device".
    I want to show this in a jsp page.

    Any input from yourside will be highly apprciated.

  2. #2
    Join Date
    Mar 2006
    Location
    Discworld
    Posts
    75
    SELECT device, COUNT(device) AS device_count
    FROM user_management
    GROUP BY device
    ORDER BY device_count DESC



    device_count will gives you how many times each device was used.
    Rest have to be done on JSP level.

    If you would run on MS SQL you could make it more complicated like create function to fetch result into what ever you want like how many % of total is nokia users.
    I do not think MySQL have capacity to do that.
    Last edited by alexsts; 06-05-2012 at 12:08 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles