Skip to content
Advertisement

SQL – How to query values that are greater than the value appeared on the first day of usage?

I have the following (table).

I am trying to output all of the incidents of customers that their bill was greater than their first date visiting the restaurant bill

the output should be:

Tried doing something like that:

Any suggestions please?

Advertisement

Answer

You can use first_value():

You can also use a correlated subquery:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement