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 8080025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:17:38+00:00 2026-06-05T16:17:38+00:00

I have a MySQL db schema like so: id flags views done ——————————- 1

  • 0

I have a MySQL db schema like so:

id    flags     views    done
-------------------------------
1     2         20       0
2     66        100      0
3     25        40       0
4     30        60       0 

... thousands of rows ...

I want to update all of the rows whose flags / views are >= 0.2. First as a test I want to try to SELECT to see how many rows would actually get updated. I tried:

SELECT flags/views AS poncho FROM mytable HAVING poncho > 0.2

But this only returns like 2 rows and I know there should be a lot more than that. It seems like it’s calculating the poncho value on all rows or something odd. What am I doing wrong?

Thanks!

  • 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-05T16:17:40+00:00Added an answer on June 5, 2026 at 4:17 pm

    Use the WHERE clause instead of HAVING:

    SELECT flags/views AS poncho FROM mytable WHERE flags/views > 0.2
    

    HAVING aggregates all identical values into one row. The SQL standard would not allow a HAVING clause without a corresponding GROUP BY, but MySQL is very permissive with the standard. What you have there is effectively the same as

    SELECT flags/views AS poncho
    FROM   mytable
    GROUP  BY poncho
    HAVING poncho > 0.2
    

    More in the manual here.

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

Sidebar

Related Questions

I need to have MySQL query like this one: UPDATE table_name SET 1 =
I have MySQL running with the ASP Membership Schema I have installed the connector,
I currently have a site which uses a MySQL 4.x schema, the site uses
I have mysql database and I want a software which can draw the database
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have a MySQL database called People which contains the following schema <id,name,foodchoice1,foodchoice2> .
I have a mysql instance (and schema) running on windows that I can access
I have a database schema (MySql) exposed as a data/OData service that is queried
I have two associated tables (simplified schema) mysql> describe booking; +----------------+------------+ | Field |
I have an existing MySQL database schema in production for an PHP5 application. The

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.