Home Forums SQL Server 7,2000 T-SQL Selecting different records from a same column RE: Selecting different records from a same column

  • NPeeters

    Before I try the "stored procedure" option, please let me make You a summary:

    1. - I want to offer my Visitors to update the value (for instance) of a Contract through one of the major economic indexes monthly available.

    So, in a FORM to be POSTed to the next page, they must INPUT

    (a)the value to be updated and

    (b)(c)the month/year when it was settled ("month0", "year0"), and

    (d)(e)the month/year they want that value to be updated to ("month1", "year1") - and also, of course,

    (f) which (from a list) economic index the program should use to make this updating ("index").

    2. - these 06 informations ("a" to "f"), after DIMed and after a "request.form", come to view, normally, through the command

    ---> Response.write "date...." & month1 & "<BR>"

    3. - but not the only TWO LAST informations that must come from recordsets, oriented from those informations above.

    4. - well, in a SQL Server table "indecontb", each row brings these informations - please consider some EXAMPLES:

    COLUMNs month year index number

    --------------------------------------------------

    row nr x 04 2003 igpm 123,4567

    - - - - - - - - - - - - - - - - - -

    row nr y 09 2002 igpm 111,2233

    - - - - - - - - - - - - - - - - - -

    row nr z 07 2002 igpm 101,4774

    5. - so, if the Visitor wants to update the value $ XXX,XX of a Contract (for instance) from 07/2002 to 04/2003 using the index "igpm", the program must pick the values "101,4774" (related to the "month0/year0" of 07/2002) and "123,4567" (related to "month1/year1" of 04/2003), in order to divide one from the other.

    6. - well, THE PROBLEM IS that BOTH come from the same column ("number"). So, I tried to SELECT each one attaching to each one an "alias" (".....AS 'indexnumber0'", ".....AS 'indexnumber1'") to make possible to the system to understand them differently.

    7. - then, the program only recognizes the second...

    Plase consider the rest of the information: page in .ASP, SQL Server database, etc...

    Would You be kind in follow on helping me? Many thanks in advance!

    DHIGilson