I can't find the sumif function, how do i sum up values without create a temp table, I want to sum up values that only meet a certain criteria, that is, greater than or equal to 100
Related
The Yield values need to be created in the Measure column which is based on the same column values.
That is the Value of (Saleable MetIN+Saleable Thermal)/FeedIN.
I tried using CTE but the query is getting too big.
Columns Names:
YEAR,
ANO_MONTH,
ANO_WEEK,
MONTH_CODE,
WEEK_CODE,
EQMTID,
MEASURE,
VALUE
I have a table which is queried using pivot and the select statement returns values for Jan,Feb,Mar,....,Dec. Along with this result, i need one more column that displays the count of number of Columns(from Jan to Dec) whose value is null.
This can be done using case when and adding 1 for each month when its null....Is there is more efficient way to achieve this.
Thanks
I am wondering if there's a way to insert some scalar number into a dataframe at specific index and specific column but if there are multiple same index values:
I have this dataframe with the index value (TEVA US EQUITY) but it appears multiple times (6) in the index. I want to insert a value in the first non-empty row at specific column, so that it looks like
and the next time I insert values, I want to upload them to the second row (because the second row is the first non-empty row).
I need to create a bottom row in sql that will have regular averages for columns as well as take in the sum of two columns and calculate a weighted average for some specific columns. Is this possible?
You can compute an average one or more columns with a query like:
SELECT AVG(mycol1), AVG(mycol2) FROM mytable
You can compute a sum of multiple columns:
SELECT SUM(mycol1)+ SUM(mycol2) AS mytotal FROM mytable
You can weight the column sums:
SELECT 2*SUM(mycol1)+ 3*SUM(mycol2) AS mytotal FROM mytable
Or perform more complex operations on those SUM() or AVG() results, but think of these results as separate from the original column data, not like a "bottom row" in a spreadsheet calculation.
From a hive table, I want records which are closest to a given value of each of the columns.
E.g.
The table has columns - total_score, avg_score, etc. I want to get records which have total_score and avg_score close or equal to "a given value".
Note - Table has approx. 183 million rows and I want 1,50,000 records which are closest/equal to the given value of each of the columns.
Please help me with the process of doing it.
The general concept needs to be top x, ordered by the absolute value of difference between parameter value and values in list.