dimanche 30 septembre 2018

UPDATE column1 value in a table. Value will be 3 types(Nominated, Standy, Entry)

I am having a problem with my algorithm. Is this possible to solve? 3 queries in one function? Queries should be step by step.

Let's say that there are already rows inside the table. Some have the value of Column1 as Nominated, some are Standby, and others are Entry

  1. First update query, those entry that have the value of 'Nominated' will change into 'Standby'. /i'm done with this. I'm stuck at the lower parts/

  2. There are entries in the table where the value of Column1 is 'Entry'(by default). After the first query, this query should run. The function will get random(any number) rows which the value of Column1 is 'Entry' will change into 'Nominated'.

  3. There are entries in the table where the value of Column1 is 'Standby'. The rows from first query SHOULD NOT be included in this part. Those rows that already have the value of 'Standby' before the function start, should change into 'Entry'.

I need advices from you guys. Which is better, which is not. I'm having trouble from the 2-3 parts. Is this possible? If not, what are your suggestions?




Aucun commentaire:

Enregistrer un commentaire