Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    SQL Query using UNION

    I'm using the below existing tables to build a Glossary for our site. What i wanted to add however is a Link back to the page where the specific information is located. Is there a way I could add another tag that would allow me to identify which query the Recordset is being produced by?

    Code:
    	strSQL=" SELECT  UnitNameID AS GlossaryId , UName_E AS Term_e, UAbbr_E AS Desc_e FROM UnitNames" ' Comes from the Units Table
    	strSQL=strSQL & " Union SELECT ProductInfoID AS GlossaryId, ProductName AS Term_e, ProductDesc AS Desc_e FROM Equip_ProductName" ' Comes from the Equipment Page

  • #2
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure what you are after, but if you want to call a preset query then you could do it with a querystring variable.

    page.asp?query=myunionquery

    Code:
    	myunionquery=" SELECT  UnitNameID AS GlossaryId , UName_E AS Term_e, UAbbr_E AS Desc_e FROM UnitNames" ' Comes from the Units Table
    	myunionquery=myunionquery& " Union SELECT ProductInfoID AS GlossaryId, ProductName AS Term_e, ProductDesc AS Desc_e FROM Equip_ProductName" ' Comes from the Equipment Page
    
    sqlSQL = "SELECT * FROM table"
    If Request.QueryString("query") = "myunionquery" Then
     strSQL = myunionquery
    End If
    
    conn.execute(strSQL)


  •  

    Posting Permissions

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