Req. query

  • Hi,

    I am having a table with the following data:

    MTFOptionID          MTFOptionType              MTFOption

         1                             L                             A

         2                             L                             B

         3                             L                             C

         4                             L                             D

         5                             R                             b

         6                             R                             a

         7                             R                             d

         8                             R                             c

    Now i require to write a query, so that the final data should be like:

         1    A      b

         2    B      a

         3    C      d

         4    D      c

    I tried with case statement, but could not work out a solution. Another way is to write a stored procedure

    and insert the first set of values and then update the other set.

    Any guidance will be of great help as this table will be containing questions pertaining to match the following structure.


    Lucky

  • Will this work?

    SELECT     MTFOptionID,  MTFOption,

                              (SELECT     b. MTFOption

                                FROM          table1 b

                                WHERE      b.MTFOptionID = a.MTFOptionID +

                                                           ((SELECT     MAX(MTFOptionID)

                                                               FROM         table1) / 2)) AS fld4

    FROM         dbo.Table1 a

    WHERE     (MTFOptionID <=

                              (SELECT     MAX(MTFOptionID)

                                FROM          table1) / 2)

    Nivedita Sundar.N

  • Your example can there be more L and Rs or is this table fixed in size and options?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply