>I have a old appliaction to be update.The program who develop this system think that he need a table can be add more field later, so he create a table like this:
>
>ID n(10), fieldname c(50), fieldvalue c(50)
>
>If there are 2 field now, the table's content will like this:
>
>ID fieldname fieldvalue
>__________________________________
>1 field1 value1 of 1
>1 field2 value2 of 1
>2 field1 value1 of 2
>2 field2 value2 of 2
>3 field1 value1 of 3
>3 field2 value2 of 3
>...
>
>
>My question is: How can i use a sql statement to transform this structure into a normal cursor ?
>
>field1 field2
>__________________________
>value1 of 1 value2 of 1
>value1 of 2 value2 of 2
>value1 of 3 value2 of 3
>....
I wouldn't try to do this with SQL. Anyway for only 2 fields as in your sample :
SELECT a.id as 'id', ;
a.fieldvalue as 'field1', b.fieldvalue as 'field2' ;
FROM old a ;
INNER JOIN old b ON a.id = b.id ;
WHERE a.FieldName = 'field1' AND b.FieldName='field2'
Cetin