View previous topic :: View next topic
|
Author |
Message |
tilak_arani
New User
Joined: 07 Sep 2006 Posts: 6 Location: chennai
|
|
|
|
This is how my table looks
Fac_id Field_name Value1 value2
1 Name 23 9
1 AGe 23 9
1 income 23 9
2 Name 23 9
2 AGe 23 9
2 income 23 9
3 Name 23 9
3 AGe 23 9
3 income 23 9
4 Name 23 9
4 AGe 23 9
4 income 23 9
Like this thr are some 250 Fac_id's...sequence is missing (1,2,3,4,7,9,...300)
Now my job is to insert a new field_name 'Annuity' for all of the Fac_ids...
the value1 and value2 fields are already defined as '0' and '2' respectively.
I need to write a spufi and not program.
Please assist me in writing the sql-query for the above[list=][/list] |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Code: |
insert into table1
(select fact_id, 'Annuity', '0','2' from table1
group by fact_id) |
|
|
Back to top |
|
|
tilak_arani
New User
Joined: 07 Sep 2006 Posts: 6 Location: chennai
|
|
|
|
Quote: |
it wokred. thanks a lot |
|
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
you're welcome.
The first one is for free, next time I'll give hints and you have to solve it yourself.
This is basic SQL so you really should have known this. |
|
Back to top |
|
|
|