Skip to content

Tag: db2

How to use result of SELECT in a limit

I have a table here that keeps repeating results over environments. Cf : … etc etc. I tried to use a group by but as there are slight changes in the encoding, it’s not really effective. I tried to specify an environment too but from a machine to another, it changes. But I do have a Column named ” Ordinal_Position

Concatenate the contents of two rows into one column (SQL DB2)

as it says in the title, I need to return two records but in the same column, for example (I clarify that the following code does not work, it is only to understand my case): When doing the query, it would have to return something like Johnny|Depp in the first column and 45 in the second Answer There are 2

Reverse EBCDIC sorts numbers before letters in ROW_NUMBER function

So I do have following SQL select Key is of the type VARCHAR(12). I wonder why the hell the numbers are sorted after the letters. Every other system including UTF-8 always begins with numbers. Answer So a solution you can do is to take advantage of the EBCDIC character order. Special characters are sorted before the letters! If the numeric

select all “groups/partitions” where parameter is found

Without going into too much detail – I need to create groups (grouped on a specific field) of data and then display all GROUPS of records that contain a parameter. I need all records in a GROUP even if some do not match the parameter. Any GROUPS where no records contain the parameter would be suppressed. I’m working with db2

DB2 SQL query to SUM the column and Subtract column

I have TRAN_AM (Transaction amount) and DB_CRD_ID(Debit Credit ind). I have to SUM the TRAN_AM based on the credit debit indicator in a single query. Input: My output should be 10, D. Also have to manage negative if Credit is higher. This query will be used as subquery, As I have to compare this amount with the another table. Thanks

DB2 SELECT from UPDATE Options

I am currently trying to do an However, the version of DB2 I have does not appear to support this Is there any alternative to this in DB2 that could be return a desired result? Where in one query we can Update and Return the result? EDIT – The Select statement is supposed to return the values that are to