Viewing 15 posts - 3,166 through 3,180 (of 3,396 total)
If you're creating a stored procedure to put your CTE in, just pass @StartRange DATE, @EndRange DATE...
November 14, 2013 at 6:54 pm
Kind of depends where you do the limiting... if you do it in the stored procedure, use something like
SELECT...
FROM ...
[SomeDate] >= DATEDIFF(m,-3,GETDATE())
Trying to subtract from a MONTH() value won't work.
November 12, 2013 at 5:19 pm
Not sure you can show a many-to-many relationship without a child table. That's just the standard way to do it... the standard example is
Invoice--(1,M)--LineItem---(M,1)--Product
where the LineItem table...
November 11, 2013 at 4:01 pm
In the first/inner query, use a DISTINCT.
SELECT DISTINCT [column list]
and then in the outer query, do your sum
SELECT Col1, Col2, SUM([numericColumn])
FROM
(SELECT...
November 6, 2013 at 5:52 pm
Try this:
SELECT DocumentNum, LineNum, CustomerNum, MAX(VersionNum) AS MaxVersion
FROM tempSalesOrder
GROUP BY DocumentNum, LineNum, CustomerNum;
November 3, 2013 at 5:29 pm
that and the windowing functions.
Thanks!
October 28, 2013 at 12:48 pm
I had a disaster like this once, but it was in [ick] Access. After I restructured and showed them how simple it was to query, they were sold.
October 25, 2013 at 5:21 pm
petronas40 (10/22/2013)
Customer ID Address
6237 ...
October 22, 2013 at 8:52 pm
Just thinking...
what if you did a summary on this:
iphone_id,
seriel_number,
max(date_assigned),
and then joined that result back to the table to return the rest of the info you need?
so
max(date_assigned) = assignments.date_assigned
and...
October 22, 2013 at 8:48 pm
Use MAX
Group by the stuff before the dash.
CAST the stuff after the dash as a number, get MAX of it.
October 21, 2013 at 2:58 pm
I have a report which has times in the following format: (11:20:01). I need to have a subtotal row added which has an AVG of all the times. I am...
October 20, 2013 at 7:14 pm
Having Access able to see/modify data in your database is a terrifying idea, IMO. You might be safe if you grant the users ReadOnly access, but a knucklehead with...
October 17, 2013 at 11:26 pm
Client want read/write access to all authenticated domain users on table in database .
Explain to them the potential problems with complying with such a request. There are good reasons...
October 17, 2013 at 11:20 pm
If these are columns in your query...
[Ship To Dealer],[Car Line],Status,Count
SELECT [Ship To Dealer],[Car Line],[Status] As BadReservedWord, COUNT(*) AS LineCount
FROM MyTable
ORDER BY [Ship To Dealer],[Car Line],[Status]
GROUP BY [Ship To Dealer],[Car Line],[Status]
October 17, 2013 at 2:10 pm
Post enough information so that people can help you.
1. Table definitions (right-click, script CREATE TABLE... to clipboard)... paste here.
2. Some data (a few records - enough so we know what...
October 17, 2013 at 2:08 pm
Viewing 15 posts - 3,166 through 3,180 (of 3,396 total)