Hi,
I've been worrying at this one for a while without result. The person responsible for making it work resorted to a cursor but I feel that it should be possible to develop a set-based query.
In essence: there are records recording periods worked, each with a start and end date. There may...
Just out of interest - what are you recording in the table? Do you really need the level of granularity implied by your estimate of 750 million rows - that is an awful lot of information to rake through. What data type are the three columns you have called FIELD1..3?
You need to filter the two results tables by date and summarise them by employee:
SELECT
emp_id
, sum(job_done) num_jobs
, avg(score) avg_score
FROM job_done
WHERE date BETWEEN (@from AND @to)
GROUP BY
emp_id
and
SELECT
emp_id
, sum(job_failed) num_jobs
FROM job_failed
WHERE date...
I didn't think that a TOP query worked without an ORDER BY? It might not be giving the results you expect.
Anyway, you could try grouping and sorting it just once:
SELECT TOP 10
CODE
, CODES_COUNT
FROM
(
SELECT
CODE
, count(*) CODES_COUNT
FROM
(
SELECT
CASE WHEN...
If you are using C#, perhaps you could use the SSMS object model and call whatever method it uses to generate a script? There's no guarantee that it exposes the method, nor, if it does, that you can capture its output; but it might be worth exploring - it could save a lot of work.
Could you put the horrible browser-detection code on the 'home' page to redirect appropriately, but put links on the two sub-sites' 'home' pages to the other one? E.g.:
www.domain - detects platform and redirects to www.domain-mob or www.domain-oth
www.domain.mob - has mobile content plus...
Thanks for taking the trouble to post the solution. What does fixmapi.exe do - generate a new version of mapi32.dll including the newly-registered COMs?
I think your logic explanation is incorrect. Do you mean:
IF @Assignee is null or blank
THEN
return rows irrespective of value of assignee (no filter)
ELSE
return only those rows where assignee contains @Assignee
END
? If so, try:
...
WHERE nvl(@Assignee, '') = '' OR CHARPOS(assignee...
I'm not sure what the second table (View_userproperties) or the CROSS JOIN is doing in there - it returns all possible combinations of rows in the two tables. Have you got two views on one table? If so, this might be a bit closer to what you need...
SELECT
emp.User_id
, emp.[First Name]
...
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.