FAQ Database Discussion Community


Comparing lists with min() based on out of order comparisons

python,list,min
I have a list of lists, for example q = [[1,2],[3,4]], where each sub-list is a list of 2 integers, and I return the index of each extreme point (I think?). What I need is the index of the list with the min/max value in the second entry out of...

EXCEL VBA: finding lowest value in column

excel,vba,excel-vba,min
i have tried to make select to pick column and find lowest value, but i dont know whats wrong: mazas = Application.WorksheetFunction.Min(Sheets("maping").Range(Range("C3"), Range("C3").End(xlDown)).Select) I think the biggest problem is that i dont know lenght of column it can gave 3 number or 3000 numbers, but it will always start at...

Follow the minimum value in a collection of values which can only increase

java,algorithm,collections,min
I have a large collection of integers, the value of which can only grow (I'm counting stuff). For efficiency reasons, I separately keep a max value, which is updated whenever needed: // when increasing the i'th count coll[i] += 1; // check whether also to update the max: if(coll[i] >...

minimum date among several columns

sql,count,min
I'm trying to get a count of a number of policies issued per month. This is close to returning the correct information: SELECT count(policy_no), left(issue_date,6) FROM table_a WHERE indicator = 'fln' GROUP BY left(issue date,6) the indicator is narrowing it down to the types of policies I want. The only...

XSLT - Selecting Min, Max, and Avg Attribute Values - Need Data from different Levels

xml,xslt,max,average,min
I thing my problem is that the attribute is on a couple of nodes down from the node that I need to select. Also, I need to pull values from different levels. Not sure how to construct the XPath. <?xml version="1.0"?> <software_inventory> <software xmlns:xsi="Software.xsd"> <title>Adobe Photoshop</title> <vendor>Adobe</vendor> <category>Graphics</category> <support_platforms> <platform>Windows...

Learning to use methods, keep getting error: “cannot convert from void to int”

java,methods,max,min
I'm trying to make a script that prints out the biggest and smallest number using methods, however I have no clue why my methods don't work... I placed a comment next to where I keep getting the error. I don't really need help with getting the script to work however...

Find MIN value based on two columns in MySQL

mysql,database,group-by,min
I've table in MySQL with athletic performs. Structure: id (PRIMARY KEY) athlete_id (FOREIGN KEY) perform category_id discipline_id If I want to select the best performs from this table (each athlete can be in results max once), I use this query: SELECT * FROM performs NATURAL JOIN athletes JOIN (SELECT athlete_id,...

Oracle SQL to get min number from case statement

sql,oracle,function,case,min
I have this query below (in Oracle PL/SQL) which I am trying to pull a price, it seems to give me 3 records but I only want one. I want to show the lowest rate if I run into this kind of scenario, can I possibly put a min function...

retrieve all the smallest strings from a set in python

python,string,list,set,min
I have a set which looks like set(['A', 'BF', 'B', 'BA', 'ABF', 'AF', 'F', 'BFA', 'AFB', 'BAF', 'FA', 'FB', 'AB', 'FAB', 'FBA']) and I'm trying to get all Strings which has the smallest length into a list I tried using print min((element for element in getParts(working_scheme,k)), key=len) which just prints...

Computationally non tolling algorithm to find min and max of a variable wrt a factor in r in large data frame?

r,max,min
I have a very large data frame where some values are associated to a factor, like this: value user 12 USER1 4 USER5 6 USER3 50 USER1 2 USER2 1 USER1 8 USER5 9 USER3 55 USER1 15 USER2 I want to find out the max and min of the...

Dynamic minimum value for specfic range (mysql)

mysql,dynamic,max,min
I am looking for a solution to SELECT (or otherwise derive) the values for Column C (minimum price for last 3 days only, not for the whole column). ---------------------------------------- Date | Unit_ | Low_3_days | | price | | ---------------------------------------- 2015-01-01 | 15 | should be: 15 | 2015-01-02 |...

Python - File does not exist error

python,directory,max,min
I'm trying to do a couple things here with the script below (it is incomplete). The first thing is to loop through some subdirectories. I was able to do that successfully. The second thing was to open a specific file (it is the same name in each subdirectory) and find...

How to get change points in oracle select query?

sql,oracle,max,min,row-number
How can I select change points from this data set 1 0 2 0 3 0 4 100 5 100 6 100 7 100 8 0 9 0 10 0 11 100 12 100 13 0 14 0 15 0 I want this result 4 7 100 11 12 100...

How to get the node with min attribute value?

xml,xpath,min,nodelist
My xml structure is something like this : <page height="777" width="777"> <block r="777" l="778" blockType="Text"> <region/> <separator/> </block> <block r="777" l="790" blockType="Text"> <region/> <separator/> </block> <block r="777" l="688" blockType="Text"> <region/> <text/> </block> </page> i want the select the block node which has the min "l" value i.e "688" I know...

SQL query display min count rows only

sql,oracle11g,count,min
I am trying to only display the cost value of cars which belong to categories with the minimum category count totals This the query I am trying to use: select model, VIN,cost from stock Desired Output: Model - VIN - Cost STI XXXXXXXXXXXX $55,000 I understand that a having operator...

Linear Hashing: Fast Method for finding 'min' and 'max'

c++11,max,min
i implemented a min() and max() function for my Linear Hashtable, but i have little performance issue, because i implemented it straight forward. I just assume that the first element that has been found is the min/mix and then i compare the rest of the elements against it. Is there...

How to set maximum & minimum limits to date picker?

android,max,min,android-datepicker
I am using date picker in my application couples of time. I want my date picker to show dates following some restrictions. I am using the below code:- @Override protected Dialog onCreateDialog(int id) { switch(id) { case DATE_PICKER_DIALOG: datePickerDialogDateSetListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker datePicker, int selectedYear, int...

Is there any logical reason for using “h = Math.min(h, h)” in Java?

java,min
I've been looking at some source codes to better understand the core of this game we use, and to program more reliable and faster plugins. Then I found this curious piece of code... public void setMaxH(double amount) { super.setMaxH(amount); this.h = Math.min(this.h, this.h); ... } I can not fathom any...

R : min and max numeric value with name

r,max,min
NAME Number cars 10 people 340 bus 4 I have to find way to rapresent minimum and maximum numeric value with his correspondent name from first coulmn. if I put command : min(data[,2]) max(data[,2]) the results are only values the final result should be displayed like : for minimum value*...

SQL row name after max/min [closed]

sql,sql-server,min
Why does this work? select i601_ID, min(row) row from SortPlaetzeDate It works but why?...

Find first increasing value in vector

r,min,self,uniform
I draw a random sample from Uniform Distribution by u <- runif (1000,0,1) Now I want to calculate the value of this random variable N = min_n {n : u_n > u_{n-1}} Edit Let say I draw a random sample of size 10. So, I have u= (u_1,u_2,u_3,...,u_10). Now I...

Adding max(count) and min(count) to query

sql,oracle11g,max,min
I am trying to add max and min to the query below: SELECT category, COUNT(distinct VIN) COUNT FROM stock group by category order by category ASC The desired results are to show the category with the most items in the count and to show the category with the least items...

displaying minimum and maximum of a vector C++

c++,vector,max,min
I have written code that outputs the total rainfall for a set amount of years. My question is how would I just display the year with the largest and smallest rainfall i.e the maximum and minimum of the dataset with the corresponding year. The output i have so far is:...

Oracle: Select Min with Where Clause

oracle,oracle11g,where-clause,min
I am trying to run the following statement against an Oracle database and getting a missing expression message. I suspect the issue is because the SELECTs for MINOVERLAP and MAXOVERLAP don't recognise OVERLAPS as a table, but I am now stuck. I am running this query within a tool called...

Select Min value row in oracle

sql,oracle,oracle11g,min
I want to select the whole row which has a min price. Because I need some more column's data to display which has minimum price. Something like below. SELECT ep.*, min(ep.price) minprice FROM Equip_price ep; How can I get done with Oracle DB? Update I actually want to get the...

Minimal cut/maximum flow in directed graph

min,max-flow,ford-fulkerson
I have a directed graph Firstly, I used Ford-Fulkerson's algorithm to increase the flow of the network. When I marked the vertices, I saw that flow on path: s->a->b->d->t can be increased by one so graph changed to: I know that when searching for maximum flow, you need to add...

SQL Server query - Min, Max, Avg aggregates issue

sql,sql-server,max,average,min
I would like to have some statistic data (min, max, average) from a database but I am currently facing a problem. I think the syntax is incorrect but I am not sure. I can not get expected results. Here is the table; name period b c ----------------------------- KONYA July -...

Why does python max('a', 5) return the string value?

python,max,min
Tracing back a ValueError: cannot convert float NaN to integer I found out that the line: max('a', 5) max(5, 'a') will return a instead of 5. In the above case I used the example string a but in my actual case the string is a NaN (the result of a...

Javascript max and min not working

javascript,input,user,max,min
I am trying to create a page that lets the user enter three numbers, and have the max and min values printed below from the input. I've used both the Math.max/min functions and also tried an if statement but When I click submit nothing shows up. Some insight would be...

awk script to find local minimum and local maximum from 2 clomun data

awk,max,min,derivative
I want to know simple implementation of finding local extreme from a datafile. Specifically saying, My input data is: x y 163.858 14.0919 166.269 14.2113 168.688 14.2855 # local max. 171.109 14.2766 173.524 14.1439 178.353 13.7528 180.768 13.6166 183.189 13.5753 # local min. 185.61 13.6128 188.03 13.6525 190.454 13.776 195.281...

Max and min in Scheme

scheme,max,racket,min
I need to get the max and min of a list in scheme. I have the whole code but there is something wrong. I am not sure what, maybe with the parenthesis. Can anyone help? #lang racket (define (maxmin L) (cond ((null? L) '()) ((null? (cdr L)) (list (car L)...