ChewDoggie
Programmer
Hello All!
I've been on this for four days. A previous post today was trying a different approach but didn't work out.
I'm having an "issue" with a sql query. My db is Access 2000 and my query concerns two tables: "Racer" and "Registration".
THe racer's table contains all racer's information (racerid, name, address, etc). The registration table contains all registration data, including classes they've been registered for and classes they've been deleted from.
I've constructed this aql statement and it seems to work pretty good except for one (lousy stinkin') condition:
sql = "select distinct racer.racerid, racer.lname, racer.fname, racer.amanum, racer.tempnumber, racer.city, IIF(registration.Status = 'Y' and registration.eventid = " & entId & ", 'YES', 'NO') from registration RIGHT JOIN racer on (racer.racerid = registration.racerid) order by racer.lname, racer.fname"
THe one condition is....if a racer has been registered for one class (status = "Y") and deleted from another class (status="D"), then that racer's name appears TWICE in the resulting recordset. This is an unacceptable result. I want each name to appear in the list ONCE.
I tried incorporating a "where clause" into the sql statement, but that only acted like a filter and eliminated a bunch of racer's from the result set which is even more unacceptable.
Can anyone help me with this?
Thanks!
ciao for niao!
AMACycle
American Motorcyclist Association
I've been on this for four days. A previous post today was trying a different approach but didn't work out.
I'm having an "issue" with a sql query. My db is Access 2000 and my query concerns two tables: "Racer" and "Registration".
THe racer's table contains all racer's information (racerid, name, address, etc). The registration table contains all registration data, including classes they've been registered for and classes they've been deleted from.
I've constructed this aql statement and it seems to work pretty good except for one (lousy stinkin') condition:
sql = "select distinct racer.racerid, racer.lname, racer.fname, racer.amanum, racer.tempnumber, racer.city, IIF(registration.Status = 'Y' and registration.eventid = " & entId & ", 'YES', 'NO') from registration RIGHT JOIN racer on (racer.racerid = registration.racerid) order by racer.lname, racer.fname"
THe one condition is....if a racer has been registered for one class (status = "Y") and deleted from another class (status="D"), then that racer's name appears TWICE in the resulting recordset. This is an unacceptable result. I want each name to appear in the list ONCE.
I tried incorporating a "where clause" into the sql statement, but that only acted like a filter and eliminated a bunch of racer's from the result set which is even more unacceptable.
Can anyone help me with this?
Thanks!
ciao for niao!
AMACycle
American Motorcyclist Association