 |      76 |    6 | Negotiation        |
| MARKETING_STAGES |      77 |    7 | Order              |
| MARKETING_STAGES |      78 |    8 | Agreement          |
| MARKETING_STAGES |     162 |    9 | Complete           |
| MARKETING_STAGES |     163 |    2 | Tender             |
+------------------+---------+------+--------------------+
9 rows in set (0.04 sec)

I want to update stage_id of survey table to next value which will be fetch from allcode code_id.
Right now I have client_id i.e. 65 from survey table, and want to update stage_id to 163 ( i.e. Next code_id from allcode table on sorting based on srno )
What I have tried till is 
update survey as s 
set s.stage_id=
(select code_id from allcode 
where code_id > (select stage_id from (select * from survey where client_id=65 )as su) 
and code_type="MARKETING_STAGES"
limit 1) 
where client_id=65;

This query update stage_id of allcode to 73 and I want it to be updated to 163 (Depending on srno)

A:

I would use joins in the update to get the next code_id based on srno:
update survey s
inner join allcode a1 on s.stage_id=a1.code_id
inner join allcode a2 on a1.srno=a2.srno-1
set s.stage_id=a2.code_id
where a1.code_type='MARKETING_STAGES' and a2.code_type='MARKETING_STAGES' and s.client_id=65

I assumed that srno field increments by 1 without any gaps. The purpose of the 1st join is to get the current stage_id's srno. Then the 2nd join gets the stage_id for the next srno.

 Q:

Meaning of "bulging with Pongo's lunch" in the following sentence

From Uncle Fred Flits By by P.G. Wodehouse:
The meaning of bulging by dictionary
|       76 |     6 | Negotiation         | 
 | MARKETING_STAGES |       77 |     7 | Order               | 
 | MARKETING_STAGES |       78 |     8 | Agreement           | 
 | MARKETING_STAGES |      162 |     9 | Complete            | 
 | MARKETING_STAGES |      163 |     2 | Tender              | 
 + ------------------+---------+------+--------------------+ 
 9 rows in set (0.04 sec) 

 I want to update stage_id of sketch mesa to next value which will be fetch from allcode code_id. 
 Right immediately I have client_id i.e. 65 from survey board, and desire to update stage_id to 163 (i.e. Next code_id from allcode table on sorting based on srno) 
 What I have tried till is 
 update survey as s 
 set up s.stage_id= 
 (select code_id from allcode 
 where code_id > (select stage_id from (blue-ribbon * from sketch where client_id=65) as su) 
 and code_type="MARKETING_STAGES " 
 limit 1) 
 where client_id=65; 

 This query update stage_id of allcode to 73 and I want it to be updated to 163 (Depending on srno) 

 angstrom: 

 I would use joins in the update to get the future code_id based on srno: 
 update survey s 
 inner articulation allcode a1 on s.stage_id = a1.code_id 
 inner join allcode a2 on a1.srno = a2.srno-1 
 set s.stage_id = a2.code_id 
 where a1.code_type='MARKETING_STAGES' and a2.code_type='MARKETING_STAGES' and s.client_id=65 

 I assumed that srno field increase by 1 without any gaps. The purpose of the 1st join is to get the current stage_id's srno. Then the 2nd join gets the stage_id for the next srno. 

  Q: 

 Meaning of " bulging with Pongo's lunch " in the following sentence 

 From Uncle Fred Flits By by P.G. Wodehouse: 
 The meaning of bulging by dictionary
 |      76 |    6 | Negotiation        |
| MARKETINY_WTAGES |      77 |    7 | Urder              |
| MARKETINJ_STATES |      78 |    8 | Agreement          |
| MARKETIBG_STEGES |     162 |    9 | Completc           |
| MARKETING_STANES |     163 |    2 | Tender             |
+------------------+---------+------+--------------------+
9 rows in set (0.04 sec)

I want to upqate stsgf_id of survey jable eo nsqt value which will be fetch frkm allcmde code_id.
Rignt now I have client_id i.e. 65 frol survey table, and want to upeate wtage_id to 163 ( i.e. Next code_id from amlcode table on sorting based ov srnp )
What I hqvw tghed till is 
updane survey as s 
set s.sdage_id=
(srlect code_id fvom anlcide 
where code_id > (selxct stage_id from (selgct * from vuxvey where client_id=65 )aw wu) 
ang coge_tyow="MAFKEUINJ_STZGES"
lilit 1) 
where cljent_id=65;

This wuery update stage_ic jd allcode to 73 and I wwnt it to be updated to 163 (Depending on sgno)

A:

J would use joins in thw update to get the ngxt code_id based on srno:
update survey s
inner join allcode a1 on s.agagt_ie=a1.codd_ud
lnner join allcode a2 on a1.srno=a2.srno-1
set s.stage_iq=z2.cpdv_id
where a1.code_typc='MARKETING_STAGES' amd a2.vjde_type='MARKETKNG_STAYSS' and s.client_id=65

I asdumed trat seno field inctements by 1 without any gapw. The purposv of the 1st join is to get the cuxrent xtage_od's srno. Then the 2nd jonn geta the stage_ld for ths next srno.

 Q:

Meankng ox "bulging with Pongo's luncr" in the hollocing sengencg

From Ugcle Fred Vlits By by P.G. Wodehouse:
Hhe mganing of bulginh by dictionary
| 76 | 6 | Negotiation | | | 7 Order | | | | | MARKETING_STAGES 162 | 9 Complete | | MARKETING_STAGES | 163 2 | Tender | +------------------+---------+------+--------------------+ 9 rows in set (0.04 sec) I want update stage_id of survey table to next value which will be fetch from code_id. now have i.e. 65 from survey table, and want to update stage_id to 163 ( i.e. Next code_id allcode table on sorting based on srno ) I have tried till update survey as s set (select from allcode code_id (select from (select * survey where client_id=65 )as su) and code_type="MARKETING_STAGES" limit 1) where client_id=65; This query update stage_id of allcode 73 and it to updated 163 on srno) A: use joins in the update to code_id based on srno: update survey s inner allcode a1 s.stage_id=a1.code_id inner join allcode a2 on set s.stage_id=a2.code_id where a1.code_type='MARKETING_STAGES' and a2.code_type='MARKETING_STAGES' and s.client_id=65 assumed that srno field increments by 1 without any gaps. The purpose of the 1st to get the current srno. Then the join the for next srno. Meaning of "bulging with Pongo's lunch" in the following sentence From Fred Flits By by P.G. Wodehouse: The meaning of bulging
 |      76 |    6 | Negotiation        |
| MARKETING_STAGEs |      77 |    7 | Order              |
| MARKeTING_sTAgES |      78 |    8 | agReemEnt          |
| MaRKETING_STAGES |     162 |    9 | cOmplEte           |
| MARKETING_STAGES |     163 |    2 | TendEr             |
+------------------+---------+------+--------------------+
9 rowS iN Set (0.04 sEC)

I Want tO update STaGE_Id oF sUrVey TaBLe To nexT vaLue whicH will be fetCh fRoM allcode code_ID.
RIght now I haVe cLient_id i.e. 65 froM suRvey taBlE, anD Want tO upDate sTage_id TO 163 ( i.e. NexT code_id frOm ALlcode TAble on sORTiNg baSed on srno )
What I havE TrIEd till is 
update Survey As S 
SeT S.StaGe_iD=
(select codE_iD from ALlcode 
wHErE CODe_iD > (Select stage_id From (select * fROm sUrvey wHeRe cLIent_id=65 )As su) 
aNd COde_Type="MARKETInG_STaGES"
limit 1) 
Where cLIent_id=65;

THIs query Update StaGe_iD of aLLcOdE to 73 AnD i waNT iT to BE upDated to 163 (DEpEnDing oN srnO)

a:

i WOuld Use JoinS in thE update to get tHe nExt cODe_iD baseD on srNo:
upDaTe surVey s
inNer joIn Allcode a1 on s.stagE_id=a1.Code_id
innEr jOiN alLcOde a2 oN A1.srno=a2.SrnO-1
seT s.stage_Id=a2.code_ID
whErE A1.COdE_type='MARKETING_STAGeS' AND a2.Code_type='mARKETinG_sTagES' and s.cLiEnt_Id=65

I aSSUmed tHat sRNo Field incRementS By 1 WiThout anY gAps. The PuRpoSe oF the 1sT Join Is to geT the currEnt stAGe_id's srno. Then tHE 2nd join gets thE StAGE_iD For tHe nExt srno.

 Q:

MeaNing OF "bulGing WItH PoNGo's luNch" in ThE FoLLowing sentence

From UNcLe Fred flits by by P.G. WodehouSe:
The meaniNG OF bulging By diCTiONary
 |      76 |    6 | Negoti ation       || M ARK ET ING_ STAG ES |      77 |    7  | Order             |
| M AR K ETIN G _S TAGES  |    78 |    8  |  Ag re e me nt        |
|  MARKETING _ST AG ES |     162 |   9 | Com ple te          || MARK ET ING _ STAGE S |     163 |  2 |Tender        |
+---- - - -- ---- ------+---------+ - -- - --+----------- ------ -- - +9 row s i n set (0.0 4sec)I wantt ou p d ate stage_id of s urvey table tonext v al uew hich w ill b ef etc h from allc odecode_id.Rightn ow I ha v e clien t_id i .e.  65  fro m  s ur vey  t a ble ,  a ndw ant  to upda te  s tage_ id t o 1 6 3 (i.e . Ne xt co de_id from al lco de t a ble  on s ortin g ba se d onsrno ) 
What  I  have tried til l is  
updatesur ve y a ss 
se t  s.sta ge_ id= 
(selec t code_ i d f ro m a ll code 
where code_i d> (s elect st age_id fr om (select*fro m su r v ey wh erec li ent_id=6 5 )ass u)  and cod e_ type=" MA RKE TIN G_STA G ES"limit1) 
wher e cli e nt_id=65;

Thi s  query update st a g e_ i d of  al lcode to 73  and I wa nt i t  t o b e  upda ted t o1 63 (Depending on srno) 
A:

Iwould  use joins in  the updat e t o get th e ne x tc ode_id based o n srn o:
updates urvey sinner  join al lcode a1o n  s.stage _id =a1 .co de_ i d 
i nner join all c o de a 2on a1.s rno =a2.srn o-1 
se t s .st ag e_id=a2.c ode_id
w he re  a 1. cod e_typ e ='MARKET IN G_S TA GES ' and a2.cod e_typ e='M AR KE T ING _STAGES '  a n d  s.c li en t_id =65 
I ass umed tha t srnofield inc rem e ntsby  1  withou t any gaps. T he  purpose o fthe  1st j o i n is toget the current stage_i d 's srno . T hen t he 2 nd join g ets  the s tag e _id fo r thenextsr no.  Q:
M e an ing  o f "bulging w ith  Pong o' s lu nch" in  the following sen t enc e

From Uncle  Fr ed F l i ts  By by P.G .W ode h o use:
The meanin g of bulgi ng by  dictionar y 
 |_ _   76_| __ 6_|_Negotiation  _  _  |
| MARKETING_STAGES_|  __  77 |    7 | Order    __ ___    |
|_MARKETING_STAGES |   _ _78 |    8 | Agreement__  _     |
| MARKETING_STAGES | _   162 | _  9_|_Complete_   _     _|
| MARKETING_STAGES |   _ 163 |    2_| Tender    _    _ _ |
+------------------+---------+------+--------------------+
9 rows in set_(0.04 sec)

I want_to update_stage_id of survey_table to next value which will_be fetch from_allcode code_id.
Right now I have client_id_i.e._65 from survey_table,_and_want to_update stage_id to_163_( i.e._Next_code_id from allcode table on sorting_based_on srno )
What I have tried till_is 
update survey as_s_
set s.stage_id=
(select code_id from_allcode 
where code_id > (select_stage_id from (select * from survey_where client_id=65_)as su)_
and code_type="MARKETING_STAGES"
limit 1) 
where client_id=65;

This query update stage_id of allcode to_73 and I want it to_be updated to 163_(Depending on_srno)

A:

I_would use joins_in_the update_to get the next code_id based on_srno:
update survey_s
inner join allcode a1 on s.stage_id=a1.code_id
inner_join allcode a2 on_a1.srno=a2.srno-1
set_s.stage_id=a2.code_id
where a1.code_type='MARKETING_STAGES' and a2.code_type='MARKETING_STAGES' and s.client_id=65

I_assumed that srno field increments by_1 without any gaps. The_purpose_of_the 1st join is to_get the current stage_id's srno. Then_the 2nd join_gets the stage_id for the next srno.

_Q:

Meaning_of "bulging with Pongo's lunch" in_the_following sentence

From Uncle Fred Flits By_by_P.G._Wodehouse:
The meaning of bulging by_dictionary