Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by SimonSellick

  1. SimonSellick

    Find continuous periods with from and to dates

    That's very clever - thanks again! Simon
  2. SimonSellick

    Find continuous periods with from and to dates

    That looks useful at first glance - thank you. I will check it further at work tomorrow.
  3. SimonSellick

    Find continuous periods with from and to dates

    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...
  4. SimonSellick

    Dealing with 750 million records in MYSQL table

    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?
  5. SimonSellick

    how to make this query with 3 table

    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...
  6. SimonSellick

    Top Ten Number of Occurences with Union too slow

    Good advice as always, George. I did make the (baseless) assumption that Larry is interested in the top 10 by total occurrence, not per column.
  7. SimonSellick

    Top Ten Number of Occurences with Union too slow

    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...
  8. SimonSellick

    Creating a SQL statement to copy the structure of a table

    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.
  9. SimonSellick

    Javascript cookies

    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...
  10. SimonSellick

    Reserved word DESC workaround for JOIN statement

    Put the column name in square brackets: [DESC] HTH
  11. SimonSellick

    Loading CRM in Outlook 2010

    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?
  12. SimonSellick

    SELECT WHERE CASE WHEN @VARIABLE

    Matt, Sorry - I was having a bit of a brain blitz yesterday. NVL() is Oracle for IsNull(). Simon.
  13. SimonSellick

    SELECT WHERE CASE WHEN @VARIABLE

    Sorry! No such thing as CHARPOS in SQL Server. Try CHARINDEX.
  14. SimonSellick

    SELECT WHERE CASE WHEN @VARIABLE

    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...
  15. SimonSellick

    Duplicate Rows

    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] ...

Part and Inventory Search

Back
Top