justsomeguy Posted October 17, 2006 Share Posted October 17, 2006 I am running this on SQL Server 2000. I have 5 tables with these fields: table ug--------ugidtable u-------uidfnamelnametable s-------uidcidtotal_scorecompletedcountertable uga---------ugiduidtable ugl---------ugiduid What I need in the recordset is ug.ugid, u.uid, u.fname, u.lname, s.total_score, s.completed, s.counter, a field indicating if the ugid/uid combo is in the uga table, and a field indicating if the ugid/uid combo is in the ugl table. The constraints are that I need the entire list of ugids (possibly indicating an outer join), and the s.cid will be a constant for all rows (where s.cid='cid'). I also need the recordset ordered by ugid. There might be more then one row for each ugid, so it will need to be ordered by ugid. The only rows I need returned are ones where the ugid/uid combo appears in either the uga or ugl table, and I also need to know which it appears in.I can do this with 2 queries, I can get the list of ugids first and then the information for each one, but with the size of the data I am working with, that report takes around 30 minutes to complete. So, it's not exactly the best choice.Does anyone know how to get all of the information with 1 query? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now