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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:30:34+00:00 2026-05-26T18:30:34+00:00

SELECT date( `captureTime` ) dateDay, DATE_FORMAT( `captureTime` , ‘%H’ ) dateHour, DATE_FORMAT( `captureTime` ,

  • 0
SELECT date( `captureTime` ) dateDay, DATE_FORMAT( `captureTime` , '%H' ) dateHour, DATE_FORMAT( `captureTime` , '%i' ) dateQuarter, max( channel1_Data ) , max( channel2_Data ) , max( channel3_Data ) , min( channel1_Data ) , min( channel2_Data ) , min( channel3_Data )
FROM `sensordata`
WHERE `Sensor_sensorSerialNo` =1
AND `captureTime` >= '2011-10-16 22:15:11'
AND `captureTime` <= '2011-10-17 23:59:59'

I want to get all data from 2011-10-16 22:15:11 to 2011-10-17 23:59:59 after running the select query. And the ‘captureTime‘ column also need be divided into three columns(i.e. ‘dateDay‘, ‘dateHour‘ and ‘dateQuater‘). However, only get one row result after running the above query. I can’t see anything wrong there.

Can anyone point out the errors? Thanks in advance!

  • 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-05-26T18:30:35+00:00Added an answer on May 26, 2026 at 6:30 pm

    min, max functions are aggregate functions and are usually used with Group By clause. However If you are not using Group By clause then Min or Max value will be returned after performing calculation on complete table data. So, only one row should be returned, that would be minimum or maximum. If you want other columns to be selected, then those columns must be present in Group By clause.
    MySql allowed this query to execute, but other dbms such as SQLServer wont even allow this query to be executed.

    http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html

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

Sidebar

Related Questions

For this query SELECT min(date) min_date FROM order_products group by order_id min_date ignores the
I'd like to put this query from SQL to Django: select date_format(date, '%Y-%m') as
SELECT DATE_FORMAT(MAX(a.EffectiveDate),'%d-%m-%Y') AS `Date`, CONCAT(a.FirstNm,' ',IFNULL(a.MiidleNM,' '),' ',IFNULL(a.LastNM,' ')) AS `EmployeeName`, `b`.`BranchName` AS `Branch`
I want to SELECT a formatted date string from a datetime type in SQL
Take this simple query: SELECT DATE_FORMAT(someDate, '%y-%m-%d') as formattedDay FROM someTable GROUP BY formatterDay
Say I have a table which I query like so: select date, value from
Hey guys, I created a list for fixtures. $result = mysql_query(SELECT date FROM .TBL_FIXTURES.
I have declared a variable @date SELECT @date = CASE WHEN MAX(dt) IS NULL
How to use and clause in Django For ex: select Date(timestamp) from userlog where
SELECT DATE(DTM) AS 'Dia', ROUND(AVG(TMP)-10) AS 'Graus Dia', (SELECT ROUND(AVG(TMP),1) FROM dados_meteo WHERE HOUR(DTM)>=18

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.