max

SQL Select latest row by date

你。 提交于 2019-12-25 03:53:56
问题 I have a large amount of data that updates every 10 minutes or so. There are 128 unique ID's that need to be returned but with only there latest values CURRENT CODE SELECT DISTINCT id, MAX(extractdate) AS [extractdate], total, used, free FROM maintable INNER JOIN datatable ON maintable.unkey = datatable.dataunkey GROUP BY id, total, used, free ORDER BY id CURRENT OUTPUT id extractdate total used free 1 2014-08-28 00:20:00.000 50 20 30 1 2014-08-28 00:30:00.000 50 30 20 1 2014-08-28 00:40:00

Joomla 2.5 How many possible categories

让人想犯罪 __ 提交于 2019-12-25 02:57:21
问题 I googled but could only find answers for the max amount of articles. Question: short Version: How many possible categories (with subcategories) can Joomla 2.5 handle on a shared host. Which problems do I have to expect? Question: long Version: I m building an website for architects. The content structure looks like this HOUSES Architect A Project 1 Project 2 ... Architect B Project 1 Project 2 ... Places Architect C Project 1 Project 2 ... Architect D Project 1 Project 2 ... And so on. The

awk/bash remove lines with an unique id and keep the lines that has the max/min value in a column under the same ID

六眼飞鱼酱① 提交于 2019-12-25 02:52:09
问题 If we have the following input and would like to firstly, detect if the cpd_number ($2) is unique in the file, remove the whole row. In this case, the line with "cpd-6666666" should be removed. Secondly, if there are multiple lines kept under the same "cpd_number", only prints out the two lines which has the max and min "log_ratio" ($17). targetID,cpd_number,Cell_assay_id,Cell_alt_assay_id,Cell_type_desc,Cell_Operator,Cell_result_value,Cell_unit_value,assay_id,alt_assay_id,type_desc,operator

SQL Server: Get data from record with max date / newest date

不羁的心 提交于 2019-12-25 02:13:29
问题 I am using the following stored procedure to get the newest date out of a column which works fine. Can someone tell me how I have to amend this that I also get the rest of the data of this record selected (i.e. the one with the max date) ? The column in question is called "updated" and is formatted as datetime so the values there should be unique. Example: The max value for column "updated" is the row with "itemID" = 3. In this case I also want the rest of the data in this row selected, say

Determining the session with the highest max count

最后都变了- 提交于 2019-12-25 01:52:23
问题 I have a table that has the following fields: Visit_ID CPCCID Date Time_IN Time-Out Course LA_CPCCID There are 3 sessions, 9-12, 12-3 and 3-6. I need a script that will calculate which session has the most visitors. I have this attached code that will determine the session # and the max count: select Time_In , CASE When cast(Time_In as time) >'12:00:00' and cast(Time_In as time) <='15:00:00' /* and date = cast(GETDATE() as date)*/ then 'Session 2' when cast(Time_In as time) >'3:00:00' and

Using max and group by twice

自闭症网瘾萝莉.ら 提交于 2019-12-25 01:45:20
问题 I read some articles on this topic including: Use of GROUP BY twice in MySQL and know this should be the same logic I need but I just don’t know how to apply it. Please note that I know the schema is terrible (I still don’t understand why the edition and published tables are separate for example….) but I don’t have any power to change it. (I have some sensitive information that I am working with so I will model my problem using an example using movies instead.) Tables: Title TitleID

(Java) How to Keep Track of Numbers Entered by User for Determining Min and Max

巧了我就是萌 提交于 2019-12-25 01:43:33
问题 I have a homework assignment that is asking me to use an input dialog to ask the end user to enter a number, parse that String to an int, and then use a confirm dialog to ask if the user wants to enter another number. If they click yes, the program loops, and once they hit no, it takes all of the entered numbers and determines the min and max. How do I keep track of all the entered numbers without declaring multiple variables to hold them (since the user can technically enter an infinite

PHP MySQL max() function producing 5

女生的网名这么多〃 提交于 2019-12-25 01:26:48
问题 I am working on a survey created by PHP and MySQL. So the issue is, I am trying to create a ResponseID, which is an ID specific for every person submitting the survey. So the code was created to add 1 to the existing max value from the ResponseID column. Here's the code: //Response ID creation $query = "SELECT max(ResponseID) FROM survey"; $res = mysql_query($query); $RID = $res+1; I know I can condense it, but here's the problem: I already entered one item on the table with the ResponseID of

How to select the max of two element of each row in MySQL

人盡茶涼 提交于 2019-12-25 00:33:16
问题 I have got a table that is a result of a (My)SQL query. In this table I have the post creation timestamp and the user comment creation timestamp. The trick is that not all posts have a comment (so some comment_creation are NULL). I would like to order the rows according of the most recent creation time of the post or user comment. How can I get the max(post_creation, comment_creation) of each row and order them ( DESC order)? Thanks for all contribution. 回答1: Based on your previous question,

Getting last price from specific product on MYSQL (faster than this)

て烟熏妆下的殇ゞ 提交于 2019-12-25 00:25:50
问题 I'm grabbing the last price from a specific product, but performance is really slow on over 3 million prices. Does anyone have a better way of doing this? My server is getting hammered by this slow query. prices.id is used to store the id of the store in the prices table so I can join it with the stores.id from the stores table. SELECT prices.id, prices.price, prices.timelog, prices.user_id FROM prices WHERE prices.id IN (SELECT stores.id FROM stores WHERE city = "miami" ) AND prices.product