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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 check against records

Author  Topic 

psmith
Starting Member

1 Post

Posted - 2009-01-13 : 05:36:55
hello, im hoping someone can help me!

im trying to create a training database that can record training and link a training profile to a staff account. this is all fine and working in the database.

when i come to display the information i am having a problem....I am trying to list the required training from a linked profiles table and then if they have completed the training then to display the recorded date next to it.

I have tried many various joins etc but i cant figure this one out. All i seem to be able to display is just the required training, the required training with the same training date repeated throughout the rest of the records, or the training record on its own.

If anyone could point me in the right direction that would be appreciated.

Thanks

<%
query="SELECT linkedProfiles.Course_Name,linkedProfiles.Course_ID, ALLRECORDS.Training_Date, ALLRECORDS.Course_Name FROM linkedProfiles INNER JOIN ALLRECORDS ON linkedProfiles.Course_Name = ALLRECORDS.Course_Name WHERE Profile_ID= '"&profile&"' AND ALLRECORDS.Staff_ID='"&SID&"'"

adoConnectionString = "Provider=MSDASQL;" & "Driver={SQL Server};" & "Server=*******;" & "Database=*********;" & "UID=*******;" & "PWD=******;"

Set database = Server.CreateObject("ADODB.Connection")
Database.Open adoConnectionString
Set RSList = Server.CreateObject("ADODB.Recordset")

RSList.open query,connection,3,3
%>

<% DO WHILE NOT RSList.EOF %>

<tr>
<td><% Response.Write RSList("Course_Id") %></td>
<td><% Response.Write RSList("Course_Name") %></td>
<td><% Response.Write RSList("Training_Date") %></td>
<%
RSList.MoveNext
Loop
%>
</tr>
   

- Advertisement -