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

  • Still not sure what you want to accomplish.

    If the idea is to fetch the two indexvalues from the database in a single statement, consider writing a stored procedure.

    You would pass in the necessary variables and get the two indexes back.

    
    
    CREATE PROCEDURE up_fetchindexvalues
    @month0 int,
    @year0 int,
    @month1 int,
    @year1 int,
    @index varchar(10),
    @indexnumber0 double OUTPUT,
    @indexnumber1 double OUTPUT
    AS
    --Put your selects here...
    SELECT @indexnumber0 = number
    FROM indecontb
    WHERE year = @year0
    AND month = @month0
    AND index = @index

    --Put your second select here

    Then, in your ASP you would execute this statement as a stored procedure.

    Check following article for more info on this.

    For ASP.NET:http://qa.sqlservercentral.com/columnists/jwiner/anintroductiontousingtheadonetsqlcommandobject.asp

    For ASP:http://qa.sqlservercentral.com/columnists/awarren/introductiontoadothecommandobject.asp