...

View Full Version : SQL Query using UNION



tcadieux
01-09-2007, 04:15 PM
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?


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

degsy
01-12-2007, 02:51 PM
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




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)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum