Hey I have a SQL question..

Results 1 to 2 of 2

Thread: Hey I have a SQL question..

  1. #1
    Join Date
    Dec 1969

    Default Hey I have a SQL question..

    How can I still add the PR_Description and PR_URLofImage columns of PRODUCTS ? I realize my SQL statement is not allowing this but could not think of another way but to open up another Recordset and connection... must be an expert way to get it into the SQL?<BR><BR>sSql="SELECT PRODUCTS_COMMENTS.PR_Date, PRODUCTS_COMMENTS.PR_Comment, PRODUCTS.PR_Description, PRODUCTS.PR_URLofImage, PRODUCTS.PR_SKU " _<BR>& "FROM PRODUCTS_COMMENTS INNER JOIN PRODUCTS ON PRODUCTS_COMMENTS.PR_SKU = PRODUCTS.PR_SKU " _<BR>& "WHERE PRODUCTS_COMMENTS.PR_SKU = &#039;" & dispV & "&#039; " _<BR>& "ORDER BY PRODUCTS_COMMENTS.PR_Date Desc"<BR><BR>rs.Open sSql, conn, 1, 3, 0<BR><BR>If rs.BOF And rs.EOF Then<BR><BR>&#039; sSql2="SELECT PRODUCTS.PR_Description FROM PRODUCTS WHERE PRODUCTS.PR_SKU = &#039;" & dispV & "&#039; "<BR>&#039; rs2.Open sSql2, conn2, 1, 3, 0<BR>&#039; Response.Write "&#060;img src=&#039;" & rs("PR_URLofImage") & "&#039;&#062;<BR>"<BR>&#039; Response.Write rs("PR_Description") & "<BR><BR>"<BR>Response.Write "No Comments Found for Product"<BR><BR>Else<BR><BR>Response.Write "&#060;img src=&#039;" & rs("PR_URLofImage") & "&#039;&#062;<BR>"<BR>Response.Write rs("PR_Description") & "<BR><BR>"<BR><BR>Do While Not rs.EOF<BR>Response.Write "&#060;b&#062;" & rs("PR_Date") & ":&#060;/b&#062; "<BR>Response.Write rs("PR_Comment") & "<BR>&#060;hr&#062;"<BR>rs.MoveNext<BR>Loop<BR><BR >End If<BR><BR>rs.Close

  2. #2
    Join Date
    Dec 1969

    Default Not allowing?

    SQL does not put any limitation on what columns you have in the select clause. There is some issues with ADO and columns that are of type memo/text/clob/blob though.<BR><BR>Such columns must be the last in the select list and if you have multiple instances within a table, they should be placed in the same order as they are defined in the table. Furthermore it is not possible to have multiple references to the recordset for those columns. What you must do is to put the value in a local variable in your script. E.g.<BR><BR>lob = rs("lob")<BR>if lob &#060;&#062; "" then<BR>response.write lob<BR><BR>will work, whereas<BR><BR>if rs("lob") &#060;&#062; "" then<BR>response.write rs("lob") <BR><BR>will not.

Posting Permissions

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