473,770 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ 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_vot e;

/M

Jul 23 '05 #1
2 1112
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_vot e;


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_vot e
--
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
5908
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 ---------------------------------------------------------------------------- -------------------------------- Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
0
1925
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 of usenet servers worldwide by default. Normally groups that are under the comp.* hierarchy go through a something called RFD and CFV. comp.databases.postgresql.general has not gone through this process, therefore many servers refuse to carry
14
2586
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 200 W. Monroe St. Suite 900 Chicago, IL 60606 (312) 222-9400 Location: www.imginc.com/IMG/About+IMG/chicago.htm
61
620
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 for benchmark candidates a few years ago. Thank you to those who responded. There were many contributions of real applications, as well as a variety of freely-available programs,
1
3086
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 for each option chosen. how can i get it to do this ?? thanks brino
0
1366
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, N.W., Washington, DC 20009-1277. The meeting starts at 7:00 p.m. and usually last approximately 2 hours. If attending the meeting by Metro, get off the Dupont Circle stop and walk north to Florida Avenue...turn right. There is no cost associated...
7
2252
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 trust. Is there any way to do URL posting in a medium trust environment? I'm hoping I don't need to switch hosts because of this. Btw I've posted this a 3rd time now because I've yet to receive any replies whatsoever. I've called around...
3
1848
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 the person and places a vote for them. votes(dict,person): it shows how many votes that person in question has and zero if a nmae is tyoed that isnt in the dictionary. result(dict): shows who has the most votes.
0
1033
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, Sept. 24 from 7-9 p.m. Location:
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.