I have a complex question.
Imagine a supermarket where all sold products are written in a database. The sources are three cash registers. The database will continue filled with new data. I will:
- From a certain product (for example, "JAM", this product is part of a table 'products' in which these specific products are named) the data request which is received in a 30 second after the insertime product 'JAM'.
- The above action I break per cash register (cash_1, Cash_2, Cash_3).
- I want to select all products in all three subqueries occur.
As far as I have:
Expand|Select|Wrap|Line Numbers
- Select * From db
- Where product in (
- Select * from db
- where insertdate
- between (
- Select insertdate from db
- where product = ‘JAM’
- and source = ‘Cash_1’
- )
- and (
- (Select insertdate from db
- where product = ‘JAM’
- and source = ‘Cash_1’
- ) - (sysdate-0.000347)
- )
- )
- and product in (
- Select * from db
- where insertdate
- between (
- Select insertdate from db
- where product = ‘JAM’
- and source = ‘Cash_2’
- )
- and (
- (Select insertdate from db
- where product = ‘JAM’
- and source = ‘Cash_2’
- ) - (sysdate-0.000347)
- )
- )
- And product in (
- Select * from db
- where insertdate
- between (
- Select insertdate from db
- where product = ‘JAM’
- and source = ‘Cash_3’
- )
- and (
- (Select insertdate from db
- where product = ‘JAM’
- and source = ‘Cash_3’
- ) - (sysdate-0.000347)
- )
- )
Aldert