Skip to content
Advertisement

How to sort columns values in sql db2-400?

I have 10 columns with similar information, and I would like to sort them asc when greater than 0. For instance, from this: A1 A2 A3 A4 A5 A6 A7 A8 A9 A0 00 01 00 09 08 05 00 02 06 03 To this: A1 A2 A3 A4 A5 A6 A7 A8 A9 A0 01 02 03 05 06

SQLPLUS : set sqlformat insert : SP2-0158

I want to export all my datas as insert statement. In Sql Developer, the command “set sqlformat insert” work very well… but when I want to use it on sqlplus, I have this error message : SP2-0158 unknown SET option “sqlformat” This command work when it’s use on a script but i’ve made a script : I’ve try the same

finding missing dates in a time interval (SQL)

I am a bit of a noob with SQL, so I was searching for some bit of code that might help me find missing date values for a time interval when I stumbled upon this code. Link to the code It works really well for my problem but I am not able to understand how it increments the date. I

Get difference from top ranked item

I’m using the following query to rank items, but I need it to also show the difference between the item and the top ranked item (The top ranked item will show the difference between it and the 2nd ranked item.), like so: How do I create the DiffTop column? Answer You can use window functions for this as well: The

temporal joins in hierarchical query

I want to join various nodes of a tree, making sure the the returned root-to-leaf path is temporally valid. The tricky part is that the data source is dated with validity from-to dates. ID NVALUE VFROM VTO 1 A 2021-01-01 2021-01-31 1 B 2021-02-01 2021-02-28 2 C 2021-01-01 2021-02-28 3 D 2021-01-01 2021-01-31 3 E 2021-02-01 2021-02-28 the links are

jOOQ – DefaultRecordMapper – List

Can the DefaultRecordMapper handle lists? Model example (really getter/setter are used): class Head { public Integer id; public List positions; … } class Position { …

Advertisement