cancel
Showing results for 
Search instead for 
Did you mean: 

Help : Identifying the Multi row concept

Highlighted
Level 2 Adventurer

Help : Identifying the Multi row concept

Hello Team

can you please help me out for writing the query for a table having two similar rows have to update in other column of same row for first row as A & second row as B

 

Output for refrence

NameCityCountryFlag
SrikanthHyderabadIndiaA
SrikanthHyderabadIndiaB
RahulBangaloreIndiaA
RajeevBangaloreIndiaA
SunilHyderabadIndiaA
SunilHyderabadIndiaB

 

Also if i want to write with one particular column for example from above table it will check the name if name as two similar then it should update A and B

 

Thanks

Srikanth B

4 REPLIES 4
EDB Team Member

Re: Help : Identifying the Multi row concept

Hi Shrikant,

You can add one additional column to this table which will have the primary key and using it in update statement you can write the update query.

Highlighted
Level 2 Adventurer

Re: Help : Identifying the Multi row concept

Hi Sachin,

 

as mentioned i have added the primary key but unable to write the syntax can you please help me out for writing the syntax for it.

 

Thanks

Srikanth B

Highlighted
EDB Team Member

Re: Help : Identifying the Multi row concept

Hi Shrikant,

 

For syntax, you can refer to the below PostgreSQL documentation link. 

 

https://www.postgresql.org/docs/11/sql-update.html

Highlighted
Level 2 Adventurer

Re: Help : Identifying the Multi row concept

Hi Sachin,

 

Thanks for the reply.

 

Thanks

Srikanth B