I have created two identical tables that list all the exceptions in respect to some of the rules of the product in the data base. The table is for one week 1 table is two for two weeks Exceptions are only looking on a weekly basis and no improvement has been done in the data base. The week's double figures include an exception in one week, which I want to exclude from the two weeks of the week to the exceptions of the week. To see only the new exceptions
I recommend that you add a timestamp to the tables and on this Select / Filter Timestamp
In this way, you can put an exception to all in a table and can define just two scenes.
I'm not good with PL / SQL, but maybe you can customize your MySQL sample:
prepare the database; Connect timetable; The table became obsolete (stamp TIMESTAMP tap, error VARCHAR tap (255)); Error log (`stamp`,` error`) value (DATE_SUB (CURDATE (), INTERVAL 8 DAY), 'old'); Error log in (`ticket ',` error`) VALUES (now (),' new '); SELECT * error indicator where stamp & gt; DATE_SUB (CURDATE (), INTERVAL 7 DAY); SELECT * errorlog where the stamps are & lt; DATE_SUB (CURDATE (), INTERVAL 7 DAY); Drop database timetable;
Gives me:
mysql> SELECT * error indicator where stamp & gt; DATE_SUB (CURDATE (), INTERVAL 7 DAY); + --------------------- + ------- + | Postal stamps | Error | + --------------------- + ------- + | 2009-01-29 01:44:38 | New | + --------------------- + ------- + mysql & gt; SELECT * errorlog where the stamps are & lt; DATE_SUB (CURDATE (), INTERVAL 7 DAY); + --------------------- + ------- + | Postal stamps | Error | + --------------------- + ------- + | 2009-01-21 00:00:00 | Old | + --------------------- + ------- +
Comments
Post a Comment