Skip to content
Advertisement

Tag: oracle

SQL conditions with COUNT in select query

In the following SQL query, I want to display if factor count is greater than one select NULL else return factor. However, I get this error: EDITED It is working fine if we use it as follows, however, I need to use factor in else part and Null in IF part Answer You can’t use COUNT(factor) and factor in one

Extract month from number of days in a year

I am trying to extract month from number of day in year in Oracle SQL, for instance day 32 is february. I do not have permission to use procedure, so I have to do it just using select. Any help? Answer You get to the solution as follows. First convert the day X into a date and extract the month

SQL query return no rows

acid tran_id tran_date tran_particular tran_amt part_tran_type ab500 m1 01-01-2022 123:qwe 10 C ab500 m5 10-01-2022 124:qse 20 C ab500 m16 11-01-2022 123:pyh 10 D I have the above table named htd. I am trying to fetch the result where tran_particular is unique before the “:” Final output looking for: acid tran_id tran_date tran_particular tran_amt part_tran_type ab500 m5 10-01-2022 124:qse 20

Advertisement