Home > SQL Development > SQL Statement :S

SQL Statement :S



strSQL = "SELECT DISTINCT(nstupersonal.StudentId), nstupersonal.Forename, nstupersonal.Surname from nstupersonal inner join ( Students INNER JOIN SENSTUSTAGES ON Students.StudentId = SENSTUSTAGES.StudentId ) ON students.StudentId = nstupersonal.studentid where nstupersonal.SetId = '"& varDataSet &"' and students.courseyear=" & varYr & " And nstupersonal.LeftSchool ='N' and senstustages.stageid <> 6 Order By NStupersonal.Surname, Nstupersonal.Forename"



The above statement doesnt give me the correct sutndet id's based on the where clauses i have selected any ideas where im going wrong?

    
Guest


Do us a favor please; break that SQL statement into a readable format. I think that's the least you can do if you're asking someone to help you.

Was this answer helpful ? Yes No   
Guest


My guess would be that one of the joins is failing.



Have you tried debugging the SQL directly in the database?

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved