Home > database >  Oracle implementation on downstream data to replace the rows of data
Oracle implementation on downstream data to replace the rows of data

Time:09-16


Above data, has already realized the view, according to the time sequence, how to realize, when TSZT for loan, the bank shows JCRQ, GHRQ is empty, return date is not empty, the present line TSZT bank to return, GHRQ are replaced with the next line of GHRQ


Is there any great god online, urgent!!!

CodePudding user response:

You haven't considered you have a table design problem or there is something wrong with the business logic,
1, your data is shown in the figure all columns of data in this table?
2, the query to the data are not necessarily as you insert data sequence display,
3, from the data on the figure unable to distinguish between the two, the correlation of data must be

Usually borrowed and return are first lending have return of logic process, then you can insert the when lending to lend record, return is to modify the record, when the return time is null, said that the items are not returned, so in the table will need to have item ID as foreign keys, borrow things people ID as foreign keys, this form of ID, as the primary key, change records,

CodePudding user response:

By date after sorting data must be like that, not a problem, this is a library book data records, the other party, no single match field to corresponding to return the book and borrow books record, now want to lag function, for out of the line, by TSZT GHRQ is empty, just by the downward GHRQ GHRQ replace TSZT this business, at the same time replace lend returned by the state

CodePudding user response:

According to the date is really no problem? You out of 10 in a row, and then the next day is also one of the five consecutive, lent ten consecutive again on the third day, the fourth day also eight consecutive again, will you check the data again to see problems, there is something wrong with the database design could not give an issue,

CodePudding user response:

Have a primary key? According to the primary key to join
  • Related