Hi, Dont know if anyone can help but I need to combine three tables in a complex query. No idea how to go about it. All three work fine independantly but rather than have them split over the page I need them in one statement so I can use the query better. tblartists,tblpagetitle,tblCategories
Any pointers would be great.
Thanks in advance
Richard
- lngCategoryID=CLng(Request("CategoryID"))
-
If lngCategoryID <> "" And lngCategoryID <> 0 Then
-
-
Set conn=Server.CreateObject("ADODB.Connection")
-
conn.Open ConnectString
-
Set rs=Server.CreateObject("ADODB.Recordset")
-
rs.CursorLocation = 3
-
-
-
SQLQuery="Select artistid,categoryid,imagetitle,imagemedium,"
-
SQLQuery= SQLQuery & "imageprice,imagesize,imageyear,pictureurl,additional from tblartists Where CategoryID=" & Clng(lngCategoryID) & " "
-
-
-
strSQL="SELECT artistname FROM tblpagetitle"
-
-
-
-
strSQL="SELECT tblCategories.CategoryID, tblCategories.CategoryName, "
-
strSQL=strSQL & " Count(tblartists.artistID) AS CountOfartistID "
-
strSQL=strSQL & " FROM tblCategories INNER JOIN tblartists ON "
-
strSQL=strSQL & " tblCategories.CategoryID = tblartists.CategoryID "
-
strSQL=strSQL & " GROUP BY tblCategories.CategoryID, tblCategories.CategoryName"
-
strSQL=strSQL & " Order By tblCategories.CategoryName ASC "
-