Skip to content
Advertisement

Tag: max

SQL perform AVG after MAX

I have two tables. Table1: | ID1 | ID2 | ID3 | ID4 | |—–+—–+—–+—–| | 200 | 125 | 300 | 201 | | 206 | 128 | 650 | 261 | | 230 | 543 | 989 | 403 | and Table2: | ID1 | ID2 | ID3 | ID4 | …

Performance for Avg & Max in SQL

I want to decrease the query execution time for the following query. This query is taking around 1 min 20 secs for about 2k records. Numbers of records in table: 1348474 Number of records processed through where query: 25000 Number of records returned: 2152 I tried removing the AVG & MAX columns and it lowered to 1 sec. Is there

Using a MIN MAX query over a DISTINCT one in MySQL?

With my new job, I am needing to use SQL more and more. As I need to remove duplicate columns I thought that using a DISTINCT statement would be best. However, I was indicated that a MIN MAX statement might be more suited. As I am still fairly new to SQL I was wondering if I could get some advice

Get max value sql in Java

*I don’t get value of max in function other. Value return is “0”. I trying but not success 🙁 Image Help!!! Answer You’re not using it as it should be. First of all, you use AVG but want MAX so change it to MAX(GiaSP). Second, you must use rs.next() to have your cursor go to the first row and then

Finding max value of multiple columns in Sql

How can I find maximum value on multiple columns. This is what I have so far. This code is giving me the error: Incorrect syntax near ‘maxval’. Answer Are you simply looking for GREATEST? However GREATEST Returns NULL when a value is NULL, so you might want to care about this, too. For instance: EDIT: In case GREATEST is not

SQL max product price [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself. Closed 8 years ago. Improve this question I have a table of products and each

Problems with SQL syntax? MAX not working

postid is a increasing numeric value (1,2,3…). At the moment, the highest value is 49, but It’s pulling up 1. It seems to be ignoring the MAX statement. otherwise everything else is working great. Answer That’s not valid syntax, which engine is running it? You either need: to get multiple records, one for each title, showing the max postid for

Advertisement