Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 multiple sql statements

Author  Topic 

Basharat
Starting Member

1 Post

Posted - 2002-10-22 : 08:14:59
I am using MS Access with ASP. The following sql statement allows me to select projects and tasks from the database. The problem is when I display it on the ASP page for each task the project is displayed, which is duplicated data.

I want to display the project and then all the tasks for that project, then going to the next project displaying it and all its tasks.

The sql is below:

SELECT Projects.Project_Title, Projects.Project_ID, Projects.Project_Description, Projects.Project_Created, Projects.Project_Begin, Projects.Project_Percent, Projects.Project_Expect, Projects.Project_Close, Tasks.Task_ID, Tasks.Task_Title, Tasks.Task_Description, Tasks.Task_Percent, Tasks.Task_Begin, Tasks.Task_Close, Tasks.Task_Expect
FROM Projects INNER JOIN Tasks ON Projects.Project_ID = Tasks.Project_ID;

LarsG
Constraint Violating Yak Guru

284 Posts

Posted - 2002-10-22 : 10:50:51
Handle that in ASP

q="SELECT Projects.Project_Title, Projects.Project_ID, Projects.Project_Description, Projects.Project_Created, Projects.Project_Begin, Projects.Project_Percent, Projects.Project_Expect, Projects.Project_Close, Tasks.Task_ID, Tasks.Task_Title, Tasks.Task_Description, Tasks.Task_Percent, Tasks.Task_Begin, Tasks.Task_Close, Tasks.Task_Expect
FROM Projects INNER JOIN Tasks ON Projects.Project_ID = Tasks.Project_ID order Projects.Project_ID "
set rs = connect.execute(q)
project = ""
while not rs.eof
if rs("Project_Title") <> project then
'new project
project = rs("Project_Title")
resposne.write project & "<br>"
end if
'write rest of data
rs.movenext
wend


Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2002-10-22 : 17:19:16
Use the getRows method to create an Array from your recordset and then use the method LarsG describes it will run alot faster.



Go to Top of Page
   

- Advertisement -