I am a beginner in SQLite so I need some help to resolve a task. I have 2 tables: company_faxes:
CompanyId comp_Fax_number comp_Fax_status
1 1675
2 2044
3 4320
4 6195
5 6350
6 0871
7 0878
8 0242
9 0274
and fax_outcomes:
fax_number resp_date outcome
1675 12/15/2014 12:01 SUCCESS
2044 12/15/2014 12:00 ERROR
4320 12/15/2014 12:03 ERROR
4320 1/21/2015 13:32 ERROR
6195 12/15/2014 12:03 ERROR
6195 1/26/2015 20:15 ERROR
6350 12/15/2014 12:03 ERROR
6350 1/14/2015 17:25 ERROR
0871 12/15/2014 12:03 ERROR
0871 1/13/2015 13:47 ERROR
0878 12/15/2014 12:03 ERROR
0878 1/20/2015 13:13 ERROR
0242 12/15/2014 12:46 SUCCESS
0242 1/20/2015 13:10 ERROR
0274 12/15/2014 12:48 SUCCESS
0274 1/20/2015 13:39 ERROR
I am trying to update the status of fax_numbers in company_faxes table so
if the outcome='Success'at first attempt the status='Active'
if outcome='error'at first attempt then status='Faild1'
if outcome='Success'at sec. attempt the status='Active'
if outcome='error'at sec. attempt then status='Faild2'
Can someone help me to find a query in SQLite that will return the result that I need?
Thank you in advance!
Aucun commentaire:
Enregistrer un commentaire