navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

SQL for MSAccess: Use of AND & OR

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> SQL for MSAccess: Use of AND & OR
Page: [1]
 
dustie

 

Posts: 2
Joined: 3/22/2008
Status: offline

 
SQL for MSAccess: Use of AND & OR - 3/22/2008 10:36:26   
Individuals to receive credit for completing 5 courses. They must complete 1, 2, and 3 and then either 4 or 5 AND either 6 or 7. Some will complete all 7 - but in my results, I only want to show the first five completed. I keep getting all 7 results. How do I get just the first 5?

course 1
course 2
course 3

course 4 or 5

course 6 or 7

< Message edited by dustie -- 3/22/2008 11:16:08 >
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: SQL for MSAccess: Use of AND & OR - 3/22/2008 11:23:26   
quote:

I only want to show the first five completed.


Hi and Welcome to OutFront.

"SELECT TOP (5) * FROM...."

That'll give you the top 5 records returned but somehow I don't think that's quite what you're looking for. Maybe you can clarify?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to dustie)
dustie

 

Posts: 2
Joined: 3/22/2008
Status: offline

 
RE: SQL for MSAccess: Use of AND & OR - 3/22/2008 11:40:04   
You are right - not quite what I am looking for. They need to complete 5 courses....the first three are all required, the final two are their choices AND the order in which they complete 5 courses is up to them.

1) Course A (required)
2) Course B (required)
3) Course C (required)
4) Either Course D OR Course E
5) Either Course F OR Course G

Does this help?

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: SQL for MSAccess: Use of AND & OR - 3/22/2008 12:56:00   
Well, it depends. Are you using the DRW or straight ASP or what to connect?

Can you create the query with the appropriate results inside Access itself? If you can do that, then you can connect the DRW right to the query itself instead of putting the statement inside the DRW.

If you're using ASP, I'd just set a flag for each one while you're looping thru your recordset or array.

I suspect either of these might need some further explination so if possible, could you post what code and/or methods you're currently using?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to dustie)
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: SQL for MSAccess: Use of AND & OR - 3/22/2008 14:51:02   
What is the design of the database? eg, how do you record each course they have completed?

I would assume some kind of join table such as [TestID] . [UserID] which lists all the completed tests

A query on the user id would return all of the TestID's and you could select the top 5 as Roger did above

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> SQL for MSAccess: Use of AND & OR
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts