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...
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...
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...
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
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
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
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)...
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...
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
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...
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...
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...
An "If" construct is not going to work within your Select statement. You may be able to use a case expression with subqueries or you could create a stored procedure and use your if/then logic to build your Where clause dynamically.
But you may be better served looking into whether ISNULL or...
I have a query that results in the following ID, StartDate and EndDate in a Table Variable(A). How do I now exclude data (in the next step) that was added to my production table(B) during any of these date ranges. The variable numbers of date ranges is based on the ID. Some may have no date...
Thanks for the reply. Sorry, I should've included the possibility that there could be two or more status changes between the RC status. Like below.
RC 5/19/2008
Regular 6/12/2008
RC 10/17/2008
Regular 11/01/2008
Leave 12/09/2008
RC 01/05/2009
Woody
I need to determine the date range(s) for each given employee from the entry date of the status RC to the entry date of the next status change AND then exclude all attributes (paydates, pay, etc.) for those dates from the range of pay dates returned for that employee based on the input...
I have input parameters @SDate and @EDate for my date range. The date being compared is a date/time and so I do a conversion to (nvarchar(20),101) to get mm/dd/yyyy. The problem is sometimes the user enters the date parameters as mm/dd/yy. In this case it works fine for @SDate but the range is...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.