Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Using more than one query


Message #1 by "Craig Flannigan" <ckf@k...> on Thu, 25 Oct 2001 12:25:34 +0100
In Access, you can easily build a query which you then use inside another

query to get results.



But how do you transfer this solely into SQL code?



We prefer to keep all the source SQL code in the ASP pages, rather than

stored queries in Access, but if I delete them, it doesn't work.



For example:  (This is using the results of another query "1stWeek" before

comparing)

SELECT DISTINCTROW [1stweek].DiaryID, [1stweek].WeekStart,

[1stweek].Firstname, [1stweek].Surname, [1stweek].Recno

FROM 1stweek LEFT JOIN [2nd Week] ON [1stweek].Recno = [2nd Week].Recno

WHERE ((([2nd Week].Recno) Is Null));





I need really the SQL source for both queries, but I'm not sure how to do

this in ASP as Access runs one query, then the other. How is this replicated

in true ASP/SQL?





Cheers

Craig.



Message #2 by "Morgan, Rob" <Rob.Morgan@o...> on Thu, 25 Oct 2001 07:46:27 -0400
Tip1: Never use special characters(spaces, -, $, etc...) in columns or table

names "2nd Week".

Tip2: Use underscores where you would normally use spaces "2nd_Week".

Tip2: Never use integers to start a column or table name.



Try this (untested)



SELECT DISTINCT A.DiaryID,A.WeekStart,A.Firstname,A.Surname,A.Recno

FROM week1 A, Week2 B 

Where A.Recno = B.Recno

AND B.Recno Is Null







-----Original Message-----

From: Craig Flannigan [mailto:ckf@k...]

Sent: Thursday, October 25, 2001 7:26 AM

To: ASP Web HowTo

Subject: [asp_web_howto] Using more than one query





In Access, you can easily build a query which you then use inside another

query to get results.



But how do you transfer this solely into SQL code?



We prefer to keep all the source SQL code in the ASP pages, rather than

stored queries in Access, but if I delete them, it doesn't work.



For example:  (This is using the results of another query "1stWeek" before

comparing)

SELECT DISTINCTROW [1stweek].DiaryID, [1stweek].WeekStart,

[1stweek].Firstname, [1stweek].Surname, [1stweek].Recno

FROM 1stweek LEFT JOIN [2nd Week] ON [1stweek].Recno = [2nd Week].Recno

WHERE ((([2nd Week].Recno) Is Null));





I need really the SQL source for both queries, but I'm not sure how to do

this in ASP as Access runs one query, then the other. How is this replicated

in true ASP/SQL?





Cheers

Craig.








$subst('Email.Unsub')


  Return to Index