Skip to content
Advertisement

Tag: with-statement

Oracle: WITH-clause querying two tables

Using an Oracle database, I have two tables: I am supposed to find – using the WITH-clause – all the employees who currently work in the same department where they started to work (hire_date = start_date and same department_id). I easily got the right result using a JOIN in the subquery: (Right) OUTPUT: Unfortunately with the WITH-clause I am getting

Dates returned as columns in SQL Select

My user will submit a FromDate and a ToDate. What I want to happen is to select the dates that fall in between these dates, which I have accomplished with the script below. The dates will by dynamic. This returns that dates as rows. What I am looking for is a way to make these dates return as the columns

How to escape several with in the query?

I need to refactor my query, but I have no idea, how to do this. I can see several duplicates of using the same logic, but I continue to repeat this manner of querying from query to query, and I feel, that this kind of querying becomes my main frame of thinking of SQL and I don’t want this. Could

Advertisement