473,473 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Group votes into low, medium and high

I have a table with votes:
---------
| vote |
| 5 |
| 1 |
| 9 |
| 6 |
| 2 |
| 1 |
| 3 |
---------
And I would like to see number of votes between 1-3, 4-6, 7-10

This select doesnt work:
SELECT count(vote<=3), count(vote>=4 AND vote<=6), count(vote>=7)
FROM user_bfcore_vote;

/M

Jul 23 '05 #1
2 1096
On 29/03/2005, la*****@home.se wrote:
This select doesnt work:
SELECT count(vote<=3), count(vote>=4 AND vote<=6), count(vote>=7)
FROM user_bfcore_vote;


Try this instead:

SELECT
SUM(IF(vote <= 3, 1, 0)) AS LOW,
SUM(IF(4 <= vote AND vote <= 6, 1, 0)) AS MID,
SUM(IF(7 <= vote, 1, 0)) AS HIGH
FROM user_bfcore_vote
--
felix
Jul 23 '05 #2
thanks

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Vittorio Pavesi | last post by:
Hello, I'm using CDO in my VB Application. Does anybody know how to set the Mail priority (Urgent, Medium, Low) ?? Thanks Vittorio...
0
by: Mike Cox | last post by:
Hi. As most of you know, comp.databases.postgresql.general is a wonderful resource. What you may not know is that it has not gone through a process that would enable it to be listed on hundreds...
14
by: Kevin G. Anderson | last post by:
What: CAUG Meeting - QuickBooks IIF Files; Total Access Analyzer; CAUG Social When: Thursday, May 25, 2006, 6PM Who: Chris Monaghan and Kevin Anderson Where: The Information Management Group...
61
by: John.L.Henning | last post by:
The new CPU benchmark from the Standard Performance Evaluation Corporation is announced http://www.spec.org/cpu2006/ Readers of comp.arch and comp.benchmarks may recall that I posted a call...
1
by: brino | last post by:
hi all ! i have created an option group on a form. when i click the buttons it returns a value to a field. however it will only return a number but i want it to place certain text in the field...
0
by: Betty Harvey | last post by:
NOTE: This is the last meeting of 2006!! The next meeting of the XML Users Group will be held on Wednesday, November 15, 2006 at the American Geophysical Union (AGU) at 2000 Florida Avenue,...
7
by: AmitKu | last post by:
I am trying to do a URL post using HttpWebRequest, but it fails because I am hosting on Network Solutions, and their servers are all medium trust. Apparently HttpWebRequest doesn't work on medium...
3
by: DDCane | last post by:
i need to make a dictonary that works like so: when u type: vote(dict,person): it should vote for that person in question by modifying the dictionary and if the person does not exist it creates...
0
by: Mike Driscoll | last post by:
Hi all, The first meeting date for the Iowa Python Users Group has been decided. Here are the details: ------------------------------------------------------------ Time / Date: Wednesday,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.