Skip to content
Advertisement

How do I query time data type with between 2 times varying over midnight

How do I query time data type with between 2 times varying over midnight. Here is what I have tried. declare @timeValue time SET @timeValue = ’23:30:00′ SELECT @timeValue,DATEADD(minute, -30, @timeValue),DATEADD(minute, +30, @timeValue) WHERE @timeValue BETWEEN DATEADD(minute, -30, @timeValue) AND DATEADD(minute, +30, @timeValue) But if we take the above example for finding if the time is valid in between 30

Comma-delimit multiple columns when some values may be null

I need to comma-delimit the values contained in multiple columns, when each of the columns could contain a NULL value: Results: Is there an approach that is less cumbersome than what I’ve done for abc, preferably without having to use PL/SQL? Answer The function that you really want is concat_ws(), but Oracle doesn’t have one. But here is an alternative

group some row in resilt table

I need get a group some row select from result table. I’ve written select but have error message ORA-00913. How to write a correct select ?I have a result table: and insert: and I need to get result table: I’m trying: but ora-00913 too many values How to write correct “select” ? Sorry, There is some new conditions. The table

Find closest or higher values in SQL

I have a table: table1 I have to generate the following table: table2 So, table2 should have all values from 1 to 100. There are 3 cases: If it’s an exact match, for ex. rank 25, value would be 120 Find closest, for ex. for rank 9 in table2, we do NOT have exact match, but 1 is closest to

Left Join On And clause not supported

I’ve looked into various posts (this one, that one and this other one) and thought I got the answer. After a LEFT JOIN I may add an ON [condition] AND [other condition] (I’ve also tried WHERE). But …

Housing Society management system database structure

I am designing billing structure for housing society yesterday I googled and gone through banking billing structure and designed my database structure but I am not sure whether this would be correct. So I am putting my billing database structure. Please tell me if I am wrong any where or any changes has to be done in my database structure.

Advertisement