Click here to Skip to main content
15,900,667 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL Database deveopment Pin
pmarfleet9-Feb-08 10:11
pmarfleet9-Feb-08 10:11 
GeneralSql database conflict [modified] Pin
Cory Kimble9-Feb-08 5:28
Cory Kimble9-Feb-08 5:28 
GeneralSQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information. Pin
Sujit Gupta8-Feb-08 23:28
Sujit Gupta8-Feb-08 23:28 
GeneralRe: SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information. Pin
That's Aragon9-Feb-08 0:02
That's Aragon9-Feb-08 0:02 
GeneralRe: SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information. Pin
Sujit Gupta10-Feb-08 6:40
Sujit Gupta10-Feb-08 6:40 
GeneralQuery to find last 10 records Pin
sirisha guttikonda8-Feb-08 20:58
sirisha guttikonda8-Feb-08 20:58 
GeneralRe: Query to find last 10 records Pin
pmarfleet8-Feb-08 21:23
pmarfleet8-Feb-08 21:23 
GeneralRe: Query to find last 10 records Pin
sirisha guttikonda8-Feb-08 21:27
sirisha guttikonda8-Feb-08 21:27 
GeneralRe: Query to find last 10 records Pin
pmarfleet8-Feb-08 21:56
pmarfleet8-Feb-08 21:56 
GeneralRe: Query to find last 10 records Pin
That's Aragon8-Feb-08 21:56
That's Aragon8-Feb-08 21:56 
GeneralRe: Query to find last 10 records Pin
Sabarinathan T8-Feb-08 22:20
Sabarinathan T8-Feb-08 22:20 
GeneralRe: Query to find last 10 records Pin
sirisha guttikonda8-Feb-08 23:22
sirisha guttikonda8-Feb-08 23:22 
QuestionSyntax help - How to subtract two years from current date Pin
Smokeywade8-Feb-08 7:40
Smokeywade8-Feb-08 7:40 
GeneralRe: Syntax help - How to subtract two years from current date Pin
AlbertEiki8-Feb-08 7:46
AlbertEiki8-Feb-08 7:46 
AnswerRe: Syntax help - How to subtract two years from current date Pin
Pallab_GT9-Feb-08 7:53
Pallab_GT9-Feb-08 7:53 
GeneralAggregate Function [modified] Pin
Lash208-Feb-08 3:37
Lash208-Feb-08 3:37 
GeneralRe: Aggregate Function Pin
Michael Potter8-Feb-08 4:45
Michael Potter8-Feb-08 4:45 
It should go out-of-whack when you add class name since you would then be asking the server to give you the first attendance date of EACH class each student took. I have to assume that a student can take multiple classes in a day and that AttendanceDate does not respect the time of the class (only the date).

Here is a messy start that should work on SQL Server. I used your original query to aquire the necessary root data for finding the first class name. TOP 1 is used in case the student attends more than 1 class that day and time is not embedded in AttendanceDate.
SELECT 
    EmployeeID,
    FullName,
    FirstAttendanceDate,
    (SELECT TOP 1
         tblClass.className
     FROM
         tblAttendance
     INNER JOIN 
         tblClassInstance 
         ON (tblAttendance.ClassInstanceID = tblClassInstance.ClassInstanceID)
     INNER JOIN 
         tblClass 
         ON (tblClassInstance.ClassID = tblClass.ClassID)
     WHERE 
         tblAttendance.EmployeeID = root.EmployeeId,
         tblAttendance.AttendanceDate = root.FirstAttendanceDate) AS ClassName
FROM		
    (SELECT 
          tblAttendance.EmployeeID, 
          vwEmployeeInformation.FullName, 
          MIN(tblAttendance.AttendanceDate) AS FirstAttendanceDate
     FROM 
          tblAttendance
     INNER JOIN 
          tblClassInstance 
          ON (tblAttendance.ClassInstanceID = tblClassInstance.ClassInstanceID)
     INNER JOIN 
          tblClass 
          ON (tblClassInstance.ClassID = tblClass.ClassID)
     INNER JOIN 
          vwEmployeeInformation 
          ON (tblAttendance.EmployeeID = vwEmployeeInformation.EmployeeID)
     WHERE 
          (tblClass.ClassFormat = 'On Demand') AND 
          (tblAttendance.AttendanceDate BETWEEN '08/10/07' AND GetDate())
     GROUP BY 
          tblAttendance.EmployeeID, 
          vwEmployeeInformation.FullName) AS Root 

GeneralRe: Aggregate Function Pin
Lash208-Feb-08 5:20
Lash208-Feb-08 5:20 
Generalexporting sqlserver table data into .csv files Pin
rajeshkumar g8-Feb-08 1:05
rajeshkumar g8-Feb-08 1:05 
GeneralRe: exporting sqlserver table data into .csv files Pin
Giorgi Dalakishvili8-Feb-08 1:22
mentorGiorgi Dalakishvili8-Feb-08 1:22 
GeneralRe: exporting sqlserver table data into .csv files Pin
rajeshkumar g10-Feb-08 22:26
rajeshkumar g10-Feb-08 22:26 
GeneralRe: exporting sqlserver table data into .csv files Pin
Vasudevan Deepak Kumar12-Feb-08 2:48
Vasudevan Deepak Kumar12-Feb-08 2:48 
GeneralSQL2005 + Service Broker + CLR Stored Procedure + XML + Temp Tables Pin
Malcolm Smart7-Feb-08 23:57
Malcolm Smart7-Feb-08 23:57 
GeneralCrystal Report Pin
techpub7-Feb-08 23:22
techpub7-Feb-08 23:22 
GeneralRe: Crystal Report Pin
John_Adams8-Feb-08 1:09
John_Adams8-Feb-08 1:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.