Viewing 15 posts - 5,896 through 5,910 (of 10,144 total)
Hi Don
What are you grouping by, in order to use the aggregate operator AVG() in the original query containing this subquery?
August 16, 2012 at 3:36 am
dwilliscp (8/15/2012)
... we are guessing that all notifications fall under the highest delivery+item. Still this might be our best shot...
Of course, unless there's something in Notifications to identify which delivery/item...
August 16, 2012 at 2:13 am
BrainDonor (8/16/2012)
Although a bit dated (no pun intended) there is an interesting article by Robyn Page for various date and time conversions - http://www.simple-talk.com/sql/learn-sql-server/robyn-pages-sql-server-datetime-workbench/.
Very good it is too.
SELECT
DateFromString,
DateBackToString...
August 16, 2012 at 1:55 am
Looks like you need to roll up ztb_Carrier_Delivery_Metrics too. Try this:
SELECT
d.MAX_Delivery,
d.MAX_Delivery_Item,
n.Sales_Order_Number,
d.REF_DOC,
n.Notification_cnt
FROM (
SELECT
REF_DOC,
MAX_Delivery = MAX(Delivery),
MAX_Delivery_Item = MAX(Delivery_Item)
FROM ztb_Carrier_Delivery_Metrics
GROUP BY REF_DOC) d
INNER JOIN (
SELECT
sales_order_number,
Notification_cnt =...
August 15, 2012 at 8:16 am
SQLSACT (8/15/2012)
...Given all of this, is it safe to say that, where possible, make you indexes unique?
You've seen the benefit that a unique index can bring, but be careful with...
August 15, 2012 at 5:06 am
This should replace both original queries:
INSERT INTO tableA (Aid, ACode, ATimestamp)
SELECT
Aid
,ACode
,MIN(ATimestamp) ATimestamp
FROM dbo.ALog al
WHERE AId > 0
AND ACode IN ('RunQuote', 'Generatedocument')
GROUP BY ACode, Aid
ORDER BY ACode, Aid
-...
August 15, 2012 at 3:50 am
SJanki (8/14/2012)
I am having a strange issue.
From .NET application 5 records are inserted in a Table A.
These records are inserted at datetime=2012-08-14 14:14:49.000
There is another functionality where another...
August 15, 2012 at 3:40 am
EXEC(@aa)
There are a number of errors in this stored procedure - would you be interested in knowing what they are?
August 15, 2012 at 2:01 am
Lynn Pettis (8/14/2012)
ChrisM@Work (8/14/2012)
SELECT
bi.Building_Name,
COUNT(di.DeviceNum) NumberOfDevices
FROM #Building_Information bi
INNER JOIN #Device_Information di
ON PARSENAME(bi.Subnet,4) = PARSENAME(di.IP_Address,4)
AND PARSENAME(bi.Subnet,3) = PARSENAME(di.IP_Address,3)
AND PARSENAME(bi.Subnet,2) =...
August 14, 2012 at 8:17 am
dwilliscp (8/14/2012)
dwilliscp (8/14/2012)
Thanks for the...
August 14, 2012 at 7:39 am
SELECT
d.Delivery,
d.Delivery_Item,
n.Sales_Order_Number,
d.REF_DOC,
n.Notification_cnt
FROM ztb_Carrier_Delivery_Metrics d
INNER JOIN (
SELECT
sales_order_number,
Notification_cnt = COUNT(sales_order_number)
FROM ztb_IMP_Notifications
GROUP BY sales_order_number
) n
ON n.Sales_Order_Number = d.REF_DOC
WHERE d.Ref_Doc > ''
August 14, 2012 at 7:31 am
Here's an alternative using PARSENAME()
SELECT
bi.Building_Name,
COUNT(di.DeviceNum) NumberOfDevices
FROM #Building_Information bi
INNER JOIN #Device_Information di
ON PARSENAME(bi.Subnet,4) = PARSENAME(di.IP_Address,4)
AND PARSENAME(bi.Subnet,3) = PARSENAME(di.IP_Address,3)
AND PARSENAME(bi.Subnet,2) = PARSENAME(di.IP_Address,2)
GROUP BY Building_Name;
August 14, 2012 at 6:57 am
WannaBee (8/14/2012)
Thank you so much Chris 🙂That works just perfect!
You're welcome - thanks for the nice feedback 🙂
August 14, 2012 at 6:47 am
kgillispie (8/14/2012)
Thanks for the help!
You're welcome, though I get the feeling that we could have given a lot more. Can you post your modified code? It's likely that folks can...
August 14, 2012 at 6:02 am
call.copse (8/14/2012)
Jeff Moden (8/14/2012)
call.copse (8/14/2012)
Point 3 Managing and using auto generated CRUD procs is definitely slower than using an ORM. I promise!
That's what I like ORMs for is basic CRUD....
August 14, 2012 at 5:47 am
Viewing 15 posts - 5,896 through 5,910 (of 10,144 total)