Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by WoodyGuthrie

  1. WoodyGuthrie

    Flatten A One To Many And Concatenate The Many Attribute

    I posted this problem over at [a href="http://www.sqlservercentral.com/Forums/Topic1002255-338-1.aspx"]SQL Server Central[/a] but had problems with my data and framing the problem so I try it here. I appreciate any help. I need to bring up the "many" attribute to a single row and into a csv...
  2. WoodyGuthrie

    Can anyone think of another name for the old-style Join?

    Just so everyone knows, I learned on SS2005 (the right way). This came about because I'm rewriting a slow running query which uses multiple cursors and calls multiple table-valued function multiple times (the functions use cursors as well). The query is used by multiple reports all of which run...
  3. WoodyGuthrie

    Can anyone think of another name for the old-style Join?

    Found it.....The term is: "COMMA JOINS". Posted By SQLSister: So I've put the real task off long enough. I have no more excuses. Now I must face the big, bad, and the ugly multiple cursor'd query which calls multiple procedural coded functions which call yet more procedure coded, cursor...
  4. WoodyGuthrie

    Can anyone think of another name for the old-style Join?

    No. That's not it. Maybe it was SQL-Sister that used the term.?? Not sure. I'm almost certain it was on this forum. Maybe the quote went something like "Stop using those _______ joins!" Woody
  5. WoodyGuthrie

    Can anyone think of another name for the old-style Join?

    I've seen it on this (maybe) and other forums but cannot find it in search. It's a slang term used for the old syntax: SELECT c.strReceiptNo, d.strName FROM dbo.tblControlLog c, dbo.tblDepartments d WHERE c.guidDepartmentID = d.guidDepartmentID Thanks Woody
  6. WoodyGuthrie

    Sum from the results of a Select Query

    It seems to me the Having clause is of no use. Why the datetime conversion? Why not... Where tame_cust.Status_code <>'PB' and Tame_cust.appt_date = '2009-07-07' GROUP BY Tame_cust.Rep_Name, Tame_cust.appt_date Woody
  7. WoodyGuthrie

    Query with One-To-Many Help

    I want to do this but, using set-based code. Has anyone done this using a tally table? Thanks. http://www.tek-tips.com/faqs.cfm?fid=2146 Woody
  8. WoodyGuthrie

    Query with One-To-Many Help

    I have the following sample data and query. The tblControl (cl) has a one to many relationship with tblControlAssociates (cla) and tblControlAssignments (cls). I need to be able to bring up all associates to the same row based on the Receipt. Declare @Temp Table ( facility VarChar(25)...
  9. WoodyGuthrie

    CTE not effective / Subquery returned multiple values

    Hoping this will help. I have the following sample data. The current code above does work as long as the strAttendanceItem for which the Amnesty has been applied exists in the current result set. The problem is for those that occurred prior to the min dteAttendanceCode filter for the query. In...
  10. WoodyGuthrie

    CTE not effective / Subquery returned multiple values

    Thanks George. But this table (apc) has no date column. It only has the guid back to the original infractions in the tblAssociateAttendanceCodes (ac) which has the date I need. It is then that row (guid, attendance code, date, etc.) that is out of my query date range. Woody
  11. WoodyGuthrie

    CTE not effective / Subquery returned multiple values

    This seems like a good example of when to use a tally/numbers table but I'm just not sure how to execute it. Woody
  12. WoodyGuthrie

    CTE not effective / Subquery returned multiple values

    This works fine for attendance dates (Infractions) that are within my specified date range, but retains the Amnesty attendance date for Infraction Dates that fall outside that specified range. How can I incorporate all attendance dates so that no matter when the infraction occurred the amnesty...
  13. WoodyGuthrie

    CTE not effective / Subquery returned multiple values

    Someone tatto COALESCE on my forhead! Thanks a bunch George. Woody
  14. WoodyGuthrie

    CTE not effective / Subquery returned multiple values

    Hello Everyone! I'll try a slightly different approach here at Tek-Tips. I'm dealing with employee attendance data. An employee may receive amnesty for infractions that have occurred in the past (like unapproved absences etc.) I have an amnesty table that tracks the infraction(s) for which the...
  15. WoodyGuthrie

    help with SQL JOIN

    Not sure why you would want to choose one quantity on an item over another quantity on the same item, so I would try something like this: SELECT PM.CATEGORY , PM.RESOURCE , SUM(PM.TRANSQTY) , PO.vendditemno FROM PMTRAN AS PM LEFT JOIN PO ON PM.refdoc = po.ponumber WHERE...

Part and Inventory Search

Back
Top