SQL question.

Results 1 to 3 of 3

Thread: SQL question.

  1. #1
    Bill H. Guest

    Default SQL question.

    Not sure if this is possible. I&#039;d like to return a recordset containing the primary key, some info, AND the previous and next primary keys. Right now I have something simple like <BR>"Select alertid, body, headline from alerts where alertid = @alertid"<BR><BR>I&#039;d like that statement to also return me the previous and following alertids. Anyone know how I could go about doing this?

  2. #2
    Join Date
    Dec 1969

    Default Nevermind

    Got it...

  3. #3
    Troy Ackerman Guest

    Default RE: SQL question.

    Dim numAlertID, SQL<BR>numAlertID = Request("alertid")<BR>numAlertIDMax = numAlertID + 1<BR>numAlertIDMin = numAlert ID - 1<BR>SQL = "Select alertid, body, headline from alerts where alertid &#062;= " & numALertIDMin & " AND alertid &#060;= " & numAlertIDMax & ";"<BR><BR>(create RS goes here)<BR>numAlertIDMin = objRS("alertid")<BR>objRS.MoveNext<BR>alertID = objRS("alertid")<BR>body = objRS("body")<BR>etc..<BR>objRS.MoveNext<BR>numAle rIDMax = objRS("alertid")<BR><BR>Is that what you were looking for?<BR><BR>Troy Ackerman<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts