Skip to content
Advertisement

SQL return max in unnest

I have the following query: What should I do if I only want the query to return one array.col1 per row in table_a (let’s say I want only the max value for each case)? Answer You can use a subquery:

Stop Printing double values SQL

Hello Guys! Oracle SQL I am trying to find a way to stop my sql Query print duplicate values. For example Results coming for a table are: The result I want: Thanks in advance! Answer Use DISTINCT to remove duplicate values :

Inserting a value in particular cell of DB2 blu table

I want to insert a value in a column “column_1” of table “table_1” with a condition where column “column_2” has a particular value and column “column_3” value is not like some value. “column_2” and “column_3” are both in the same table “table_1”. I tried the following query but I am not getting require result. INSERT INTO Table_1 (Column_1) VALUES (‘Distribution’)

SQL trying to use a column from a joined table in a subquery

Here is what I currently have which returns 3 columns for patient_id, group_concat_1, and group_concat_2: However, I need to return a single column with group_concat_1 and group_concat_2 combined, so I tried this: But his clearly doesn’t work since now it can’t find patient.id in the inner subquery. Any advice? Thanks! Answer You can concatenate directly the 2 columns:

Advertisement