Skip to content

Tag: oracle

Convert a running total oracle sql query to a final total

I have the following query that works and gets me the total that I need. However, i need to change it so that it just displays the final total instead of every transaction leading up to the total. I have tried converting it by group by rollup, group by group sets, using max transaction number, but my total ne…

oracle query for merge to row into one

I have a table with which showing in_time and out_time with gate number at separate row, but I wanted to show up this in one row, so I need to merge both rows into one here is result for this | …

Deducting values from 2 case statements from one another

I have two CASE statements and I’m trying to deduct the value of one from another, but I can’t get the code to work. Does anyone have any suggestions where I’m going wrong? The 2 CASE statements are: and When I try to combine these I get errors (missing right parenthesis). The combined code …

SQL – Get previous amounts for each day

I’m trying to write a query that is sort of like a running total but not really. I want to get the previous weight (kg) and keep outputting that for each day until another weight (kg) is recorded then …

Pass subquery value to IN statement

In one table named prefs, I have a column named “Value” of type clob that holds this value: ‘T’, ‘L’ I need to query table attendance_code to retrieve the records where column att_code values are either T or L. The att_code column is of type varchar2. As a manual model quer…