Mock interview 4 - sub query needed
In Mock interview 4, is the su query really needed? can’t you do the same by adding the where clause in the first query?
2 answers ( 0 marked as helpful)
You can't reference a new alias in a WHERE clause within a query, and you can't use a windows function in a query, so I think it does need the sub query here!
The actual data is confusing to me. Is each acc_id in the table only once? It sounds like each acc_id is in the table for every single date - why? Why not just have the date it was opened, and the date it was closed?