Querying a query doesn't work

Results 1 to 2 of 2

Thread: Querying a query doesn't work

  1. #1
    Jennifer Crosby Guest

    Default Querying a query doesn't work

    I&#039;m using VBScript to create my ASP pages. I&#039;ve created a page with some pull-down menus where the user selects what options he wants when pulling data from a database on SQL Server. My page works wonderfully and I get my data inserted into an excel spreadsheet filtered correctly. My PROBLEM now is that I&#039;m trying to query the query just made so that it puts a count of the number of records just pulled and sums the numbers in a column. The query works when I try it in Access, but it&#039;s saying I have incorrect syntax in ASP. [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword &#039;SELECT&#039;. <BR><BR>Doen&#039;t make sense to me. Do I have to do things slightly different to get it to work or is there a better way to do what I want?<BR><BR> Here&#039;s the SQL code I use to query the query. The original query is SQLGetResults.<BR><BR>SQLGetTotals = "SELECT Count(" & SQLGetResults & ".Stu_id) as TotalCnt, Sum(" & SQLGetResults & ".SCH) as SumTotalSCH FROM " & SQLGetResults & " "<BR><BR>Thanks in advance for your help!<BR>Jennifer

  2. #2
    markp Guest

    Default RE: Querying a query doesn't work

    Could you get a print out of the full sql statement without the variables?<BR><BR>I think there&#039;s a problem with your sql statement. So if you just print it out on screen without actually running the sql, that might help you figure it out. Otherwise, I don&#039;t see the problem.

Posting Permissions

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