How to add an additional column in a table by comparing the values in a different column
Posted
by S-Man
on Stack Overflow
See other posts from Stack Overflow
or by S-Man
Published on 2010-04-18T22:19:02Z
Indexed on
2010/04/18
22:23 UTC
Read the original article
Hit count: 369
I have a table with the following records
id name city
1 aaa NY
2 bbb NY
3 ccc LA
4 ddd LA
5 eee NY
I want the table with an additional column by comparing the 'city' column. The values in the col4 should have '1' for every unique value in 'city' column and '0' for the repeating values in 'city' column.
id name city col4
1 aaa NY 1
2 bbb NY 0
3 ccc LA 1
4 ddd LA 0
5 eee NY 0
I hope to get some help.
Thanks
© Stack Overflow or respective owner