Jump to content

query trouble, works in access, but not on asp page


Guest XavierX

Recommended Posts

Guest XavierX

Hi,I am trying to create a web page that outputs a list of data from a join on 2 tables.The Tables:PANEL - A list of possible panel numbersPANELID - Primary key, EVENTS - List of events that occur EVENTID - Unique autonumber for each eventPANELID - posted from PANEL tableEVENTCODE - what type of event it isADATE - Date and Time the event was posted.What I am trying to achieve:I need to create a list of ALL panel IDs, regardless of whether they have any entries in the EVENTS table, but when they do, to display the max(ADATE) and event code - i.e. the last known date. If there are no events, the fields for ADATE and EVENTID should be blank.What I have:I am using the following query:

SELECT DISTINCT (PANELID) AS UPANELID, Max(EVENTS.ADATE) AS LASTCONTACT, EVENTS.EVENTIDFROM PANEL LEFT JOIN EVENTSON PANEL.PANELID = EVENTS.PANELIDGROUP BY EVENTS.EVENTID, PANEL.PANELID;

The result is something like:

UPANELID   LASTCONTACT					EVENTID10001	   04/09/2006 14:55:56	55510003		10007	   04/09/2006 09:41:21	55510008	   04/09/2006 09:44:47	55510012		10014	   04/09/2006 14:43:37 	55510015		10016		10017

Now this works perfectly in the query tab of MS Access. But when I try and use it in my .asp page using the ADODB object, I get an unspecified server error.I know it is the query that is the problem, because if I swap it for a simpler normal join, with out the LEFT, it works fine.Can anyone shed any light on why it would not work or if there is part of the query that is not compatible with ADODB?Many thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...