SQL Problem

Results 1 to 2 of 2

Thread: SQL Problem

  1. #1
    Join Date
    Dec 1969

    Default SQL Problem

    Hi all, <BR>Due to poor database structure that I&#039;m being forced to use I&#039;m having a bit of trouble running the kind of query that I want. Finally I got it going right by running one query off another. The first query looks like this, it&#039;s called qTest: <BR><BR>SELECT DISTINCT CFC_CFCWEB1.EPACCT, qryEagles.EAGL AS totEagles, qryEagles.SEAG AS totDblEagles, qryEagles.GLDE AS totGoldEagles, CFCLIB_CFCNODES.DLSN03 <BR>FROM (CFC_CFCWEB1 INNER JOIN CFCLIB_CFCNODES ON CFC_CFCWEB1.EPACCT = CFCLIB_CFCNODES.DLACCT) INNER JOIN qryEagles ON CFCLIB_CFCNODES.DLACCT = qryEagles.CEACCT <BR>GROUP BY CFC_CFCWEB1.EPACCT, qryEagles.EAGL, qryEagles.SEAG, qryEagles.GLDE, CFCLIB_CFCNODES.DLSN03 <BR>HAVING (((CFCLIB_CFCNODES.DLSN03)=66)); <BR><BR>The second is called SumEagles, and that gives me the data that I need: <BR>SELECT Sum(qtest.totEagles) AS SumOftotEagles, Sum(qtest.totDblEagles) AS SumOftotDblEagles, Sum(qtest.totGoldEagles) AS SumOftotGoldEagles <BR>FROM qtest; <BR><BR>I know it seems really backward but it&#039;s seriously the only way I can get it going. The problem is getting this to run in an ASP page. The 66 in the first query could be any # that corresponds to a record in another table. So I can&#039;t just run the second without modifying the first. How do I do that? I&#039;ve been 100% unsuccessful getting the 2 queries into 1, if I could do that it&#039;d be simple. Does anyone out there have some insight? <BR><BR>Thanks, <BR>Ted

  2. #2
    Join Date
    Dec 1969

    Default *** CROSSPOST, answered in Q&A ***


Posting Permissions

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