When I read this post: SQL: group by the minimum value in one field when selecting individual rows
The following solution made no sense to me, and I wonder how this might work:
SELECT id, min(record_date), other_cols FROM mytable GROUP BY id
This does NOT work in my database, and for some reason it seems illogical to me (although it works in the example SQL script). My DBMS complains that
The column must be a group column: other_cols
I use MaxDB - is it a specific DBMS problem?
It works in some DBMSs, such as MySQL . MySQL docs :
MySQL GROUP BY, , GROUP BY. , MySQL. , . , , , GROUP BY, .
SQL Server GROUP BY. , :
GROUP BY
"ColName" , , GROUP BY.
. MSDN.
, RDBMS , , SQL Server , (MIN, MAX, AVERAGE ..) , Group By Group By.
SQL Server
Group By
MySql, , , , , other_cols .
MySql
other_cols
, (, SQL Server).
SQL. :
SELECT mytable.id, mytable_id_with_min_date.min_record_date, other_cols FROM mytable JOIN ( SELECT id, min(record_date) min_record_date FROM mytable GROUP BY id ) mytable_id_with_min_date ON (mytable_id_with_min_date.id = mytable.id AND mytable.record_date = mytable_id_with_min_date.min_record_date)
, , other_cols?
Source: https://habr.com/ru/post/1542297/More articles:Scanf in several larynx gives unexpected results - goIn a large dataset, determine which variables are categorical and which are numeric - rWhy does the TypeFormatter web API not start in the same Call Context as the request request? - c #Не удалось выложить большую память блока после того, как много памяти malloc/free small blocks - c++Repeating console output - where do I need to insert my callback? - javascriptNumpy / scipy function to calculate "polynomial coefficient" - pythonJQuery binds two arrays (key, value) into one array - javascriptrun selenium using crontab (python) - pythonyesod-devel/ghcargs.txt: openFile: не существует - haskellLocationClient - Mock Locations - androidAll Articles