Viewing 15 posts - 4,081 through 4,095 (of 10,144 total)
T.Ashish (8/25/2013)
I have a query that takes 22 seconds.
If I create below index then query finishes in 5 seconds, but I'm told that this type of index can't be...
August 27, 2013 at 6:26 am
SELECT SUM(Boiler1)
FROM Energy_Centre_Availability eca
WHERE NOT EXISTS (
SELECT 1
FROM Energy_Centre_Boiler_Maintenance_Schedule s
WHERE eca.t_stamp > s.startDate
AND eca.t_stamp < s.endDate
)
August 27, 2013 at 4:38 am
SELECT SUM(Boiler1)
FROM Energy_Centre_Availability eca
INNER JOIN Energy_Centre_Boiler_Maintenance_Schedule s
ON eca.t_stamp > s.startDate
AND eca.t_stamp < s.endDate
August 27, 2013 at 3:55 am
;WITH SampleData AS (
SELECT * FROM (values
('8009874321', 'cars'),
('8009874321', 'Newsales'),
('8009874321', 'Newsales'),
('8009870000', 'Newsales'),
('8009870000', 'BenaSales'),
('8009870000', 'BenaSales'),
('8009870000', 'BenaSales2'),
('8009870000', 'BenaSales2')
) sampleData ([800num], CompanyName))
SELECT [800num], CompanyName
FROM (
SELECT [800num], CompanyName,
dr = DENSE_RANK() OVER(PARTITION BY...
August 27, 2013 at 3:35 am
Jan Van der Eecken (8/27/2013)
ChrisM@Work (8/27/2013)
The estimate for fitting my kitchen was nearly £3000.Was that really for the fitting only? Or including cupboards, sink, hub, worktop etc?
Jan - it was...
August 27, 2013 at 3:33 am
Why restrict yourself to a view or a function? Why not just write the query?
August 27, 2013 at 1:54 am
twin.devil (8/27/2013)
looks like a assignment question to me ... Or he is just so happy to get the answer 😛
Four years on...he's your tutor now.
August 27, 2013 at 1:52 am
Why are you using IN and not = for these comparisons?
SV00300.CUSTNMBR in (@CUSTNMBR)
or SV00300.LOCATNNM in (@LOCATNNM)
or SV00300.Contract_Number in (@Contract_Number)
If any of these variables are a comma-delimited list, they won't be...
August 27, 2013 at 1:50 am
Sean Lange (8/23/2013)
SQLRNNR (8/23/2013)
Sean Lange (8/23/2013)
SQLRNNR (8/23/2013)
Koen Verbeeck (8/23/2013)
ChrisM@Work (8/23/2013)
GilaMonster (8/23/2013)
Fal (8/22/2013)
August 27, 2013 at 1:18 am
HanShi (8/23/2013)
... A resultset in SQL cannot be aggregated like that and will show all values for each row.
I wouldn't want to bet on that "cannot", HanShi. Perhaps "cannot easily"...
August 23, 2013 at 5:49 am
From the sample data??
August 23, 2013 at 5:37 am
Thanks for posting sample data, Kelvin. What do you want the output to look like?
August 23, 2013 at 5:21 am
If your sample data doesn't look anything like your real data, then you are likely to receive queries which don't work when run against your real data.
How about an...
August 23, 2013 at 5:20 am
-- try this
SELECT n.*, d.category, d.n
FROM newtable n
INNER JOIN (
SELECT
category,
amended_sw_manufacturer,
amended_product_name,
amended_product_version,
n = COUNT(*)
FROM datalookuptable
WHERE category IN ('Licensable','Non Licensable')
GROUP BY category, amended_sw_manufacturer, amended_product_name, amended_product_version
) d
ON n.softwaremanufacturer...
August 23, 2013 at 5:09 am
Viewing 15 posts - 4,081 through 4,095 (of 10,144 total)