Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    4

    Unanswered: Obvious Newbile Question--How do I create a variable within SQL?

    I'm making an online Quiz and I have a table with a list of Category names associated with CategoryIDs that remains static.
    Another table collects data associated with these categories, and in addition to the data, contains the CategoryID for the data.

    I want to populate the select options of a drop down menu with the Categories NOT YET ENTERED for a specific Quiz. I have a form which posts to itself.

    SQL 7, ASP Javascripting goin' on.

    I did some more looking around yesterday and came up with something that works, I just have to determine how to create a variable in SQL and then pass the CaseStudyID from an ASP page...

    SELECT DISTINCT
    tblDetailCaseStudyCategory.intDetailCaseStudyCateg oryID,
    tblDetailCaseStudyCategory.strCaseStudyCategory
    FROM tblDetailCaseStudyCategory, tblCaseStudyData
    WHERE (tblDetailCaseStudyCategory.intDetailCaseStudyCate goryID NOT
    IN
    (SELECT intCaseStudyCategory
    FROM tblCaseStudyData
    WHERE intCaseStudyID = 69))

    Can anyone help with this?
    Thanks,

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Are you using a recordset object in your asp code to loop through to create the options ? Since you have a form that posts to itself, you can use that to pass the id that you need to populate the listbox - that loops through the recordset.

Posting Permissions

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