Search Results

Search found 657 results on 27 pages for 'ranges'.

Page 3/27 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Reading Excel Named Ranges by OLEDB hangs when the source file is open

    - by Sathish
    I am trying to read the Excel Named range using OLEDB using the below code "Select * from [MyNamedRange1]" everything works fine only when the source excel sheet is not opened if it is open then i am not able to read the range names using OLEDB it simply hangs Where as i am able to execute the query "Select * from [Sheet1$]" even if the workbook is open or closed... Any work arounds for reading the range by OLEDB only i dont want to go for interop... I have too many ranges defined in the excel file

    Read the article

  • I want to add ranges of rates for which I have a particular %

    - by happy
    My problem is I should add rates without overlapping and if a range of rates is missed while adding a new range I should display a message saying the range is missed. Example: 200 300 ----- 3% 300 400 ------5% and if I am adding new range, say 600 800 ------10% I should get a message saying the ranges 401 to 599 is missing.

    Read the article

  • C# Convert Excel Range to Dataset or Datatable, etc.

    - by htbrady
    I have an Excel spreadsheet that will sit out on a network share drive. It needs to be accessed by my Winforms C# 3.0 application (many users could be using the app and hitting this spreadsheet at the same time). There is a lot of data on one worksheet. This data is broken out into areas that I have named as ranges. I need to be able to access these ranges individually, return each range as a dataset, and then bind it to a grid. I have found examples that use OLE and have got these to work. However, I have seen some warnings about using this method, plus at work we have been using Microsoft.Office.Interop.Excel as the standard thus far. I don't really want to stray from this unless I have to. Our users will be using Office 2003 on up as far as I know. I can get the range I need with the following code: MyDataRange = (Microsoft.Office.Interop.Excel.Range)MyWorkSheet.get_Range("MyExcelRange", Type.Missing); The OLE way was nice as it would take my first row and turn those into columns. My ranges (12 total) are for the most part different from each other in number of columns. Didn't know if this info would affect any recommendations. Is there any way to use Interop and get the returned range back into a dataset? Thanks for your help.

    Read the article

  • Convert Excel Range to ADO.NET DataSet or DataTable, etc.

    - by htbrady
    I have an Excel spreadsheet that will sit out on a network share drive. It needs to be accessed by my Winforms C# 3.0 application (many users could be using the app and hitting this spreadsheet at the same time). There is a lot of data on one worksheet. This data is broken out into areas that I have named as ranges. I need to be able to access these ranges individually, return each range as a dataset, and then bind it to a grid. I have found examples that use OLE and have got these to work. However, I have seen some warnings about using this method, plus at work we have been using Microsoft.Office.Interop.Excel as the standard thus far. I don't really want to stray from this unless I have to. Our users will be using Office 2003 on up as far as I know. I can get the range I need with the following code: MyDataRange = (Microsoft.Office.Interop.Excel.Range) MyWorkSheet.get_Range("MyExcelRange", Type.Missing); The OLE way was nice as it would take my first row and turn those into columns. My ranges (12 total) are for the most part different from each other in number of columns. Didn't know if this info would affect any recommendations. Is there any way to use Interop and get the returned range back into a dataset?

    Read the article

  • multiple key ranges as parameters to a couchdb view

    - by kolosy
    is there a way to send multiple startKey/endKey pairs to a view, akin to the keys: [] array that can be posted for keys? the underlying problem - let's say my documents have "categories" and timestamps. if i want all documents in the "foo" category that have a timestamp that's within the last two hours, it's simple: function (doc) { emit([doc.category, doc.timestamp], null); } and then query as GET server:5894/.../myview?startKey=[foo, |now - 2 hours|]&endkey=[foo, |now|] the problem comes when i want something in categories foo or bar, within the last two hours. if i didn't care about time, i could just pull directly by key through the keys collection. unfortunately, i have no such option with ranges. what i ended up doing in the meantime is rounding the timestamp to two-hour blocks, and then multiplexing the query out: POST server:5894/.../myview keys=[[foo, 0 hours], [foo, 2 hours], [bar, 0 hours], [bar, 2 hours]] it works, but will get messy if i want to go back a large amount of time (in relationship to the blocksize)

    Read the article

  • SOLR date faceting and BC / BCE dates / negative date ranges

    - by Nigel_V_Thomas
    Date ranges including BC dates is this possible? I would like to return facets for all years between 11000 BCE (BC) and 9000 BCE (BC) using SOLR. A sample query might be with date ranges converted to ISO 8601: q=*:*&facet.date=myfield_earliestDate&facet.date.end=-92009-01-01T00:00:00&facet.date.gap=%2B1000YEAR&facet.date.other=all&facet=on&f.myfield_earliestDate.facet.date.start=-112009-01-01T00:00:00 However the returned results seem to be suggest that dates are in positive range, ie CE, not BCE... see sample returned results <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">6</int> <lst name="params"> <str name="f.vra.work.creation.earliestDate.facet.date.start">-112009-01-01T00:00:00Z</str> <str name="facet">on</str> <str name="q">*:*</str> <str name="facet.date">vra.work.creation.earliestDate</str> <str name="facet.date.gap">+1000YEAR</str> <str name="facet.date.other">all</str> <str name="facet.date.end">-92009-01-01T00:00:00Z</str> </lst> </lst> <result name="response" numFound="9556" start="0">ommitted</result> <lst name="facet_counts"> <lst name="facet_queries"/> <lst name="facet_fields"/> <lst name="facet_dates"> <lst name="vra.work.creation.earliestDate"> <int name="112010-01-01T00:00:00Z">0</int> <int name="111010-01-01T00:00:00Z">0</int> <int name="110010-01-01T00:00:00Z">0</int> <int name="109010-01-01T00:00:00Z">0</int> <int name="108010-01-01T00:00:00Z">0</int> <int name="107010-01-01T00:00:00Z">0</int> <int name="106010-01-01T00:00:00Z">0</int> <int name="105010-01-01T00:00:00Z">0</int> <int name="104010-01-01T00:00:00Z">0</int> <int name="103010-01-01T00:00:00Z">0</int> <int name="102010-01-01T00:00:00Z">0</int> <int name="101010-01-01T00:00:00Z">0</int> <int name="100010-01-01T00:00:00Z">5781</int> <int name="99010-01-01T00:00:00Z">0</int> <int name="98010-01-01T00:00:00Z">0</int> <int name="97010-01-01T00:00:00Z">0</int> <int name="96010-01-01T00:00:00Z">0</int> <int name="95010-01-01T00:00:00Z">0</int> <int name="94010-01-01T00:00:00Z">0</int> <int name="93010-01-01T00:00:00Z">0</int> <str name="gap">+1000YEAR</str> <date name="end">92010-01-01T00:00:00Z</date> <int name="before">224</int> <int name="after">0</int> <int name="between">5690</int> </lst> </lst> </lst> </response> Any ideas why this is the case, can solr handle negative dates such as -112009-01-01T00:00:00Z?

    Read the article

  • Subtracting Delphi Time Ranges from a Date Range, Calculate Remaining Time

    - by Anagoge
    I'm looking for an algorithm that will help calculate a workday working time length. It would have an input date range and then allow subtracting partially or completely intersecting time range slices from that date range and the result would be the number of minutes (or the fraction/multiple of a day) left in the original date range, after subtracting out the various non-working time slices. For Example: Input date range: 1/4/2010 11:21 am - 1/5/2010 3:00 pm Subtract out any partially or completely intersecting slices like this: Remove all day Sunday Non-Sundays remove 11:00 - 12:00 Non-Sundays remove time after 5:00 pm Non-Sundays remove time before 8:00 am Non-Sundays remove time 9:15 - 9:30 am Output: # of minutes left in the input date range I don't need anything overly-general. I could hardcode the rules to simplify the code. If anyone knows of sample code or a library/function somewhere, or has some pseudo-code ideas, I'd love something to start with. I didn't see anything in DateUtils, for example. Even a basic function that calculates the number of minutes of overlap in two date ranges to subtract out would be a good start.

    Read the article

  • Find Date From Non Contiguous Ranges

    - by AGoodDisplayName
    I am looking to find an best way to find a date from date ranges that may or may not be contiguous (I am trying to avoid a cursor, or a heavy function if possible). Lets say I have hotel guests that come and go (check in, check out). I want to find the date that a certain guest stayed their 45th night with us. The database we use records the data as so: Create Table #GuestLog( ClientId int, StartDate DateTime, EndDate DateTime) Here is some data Insert Into #GuestLog Values(1, '01/01/2010', '01/10/2010') Insert Into #GuestLog Values(1, '01/16/2010', '01/29/2010') Insert Into #GuestLog Values(1, '02/13/2010', '02/26/2010') Insert Into #GuestLog Values(1, '04/05/2010', '06/01/2010') Insert Into #GuestLog Values(1, '07/01/2010', '07/21/2010') So far I can only think of solutions that involve functions with temp tables and crazy stuff like that, I feel like I'm over thinking it. Thanks ahead of time.

    Read the article

  • GNUPlot: plot different ranges with different styles

    - by Mr. Shickadance
    Hello all, I know this should be pretty simple, but I haven't been able to find a similar example. I need to plot different ranges of a datafile differently, but on the same graph. For instance, say my datafile represents a function with x and y values. I want to plot the first N values using a style like lines, and then the next M values using a different style, like points. I was thinking I would need a plot command similar to this: plot [1:5] "my.data" using 1:2 with lines, [6:12] using 1:2 with points, [13:19] using 1:2 with lines Essentially I want to distinguish different areas of the functions. Any ideas? I am sorry if it sounds like I'm rambling but I am quite stumped. Thanks in advance!

    Read the article

  • Find gap between start and end dates for multiple data ranges with overlaps

    - by sqlint
    Need to find gap between start and end dates more than 20 days for multiple data ranges with overlaps. One Id has multiple start dates and end dates. Following Id 1 has two gaps less that 20 day. It should be considered as one range from 10/01/2012 to 10/30/2014 without any gap. 1 10/01/2012 02/01/2013 1 01/01/2013 01/31/2013 1 02/10/2013 03/31/2013 1 04/15/2013 10/30/2014 Id 2 has a gap more than 20 days between end date 01/30/2013 and start date 05/01/2013. It has to be captured. 2 01/01/2013 01/30/2013 2 05/01/2013 06/30/2014 2 07/01/2013 02/01/2014 Id 3 should be considered as one range from 01/01/2012 to 06/01/2014 without any gap. The gap between end date 02/28/2013 and start date 07/01/2013 should be ignored because range from 01/01/2012 to 01/01/2014 cavers a gap. 3 01/01/2012 01/01/2014 3 01/01/2013 02/28/2013 3 07/01/2013 06/01/2014 The cursor can do it but it works extremely slow and not acceptable. SQL fiddle http://sqlfiddle.com/#!3/27e3f/2/0

    Read the article

  • How to get several frequency ranges at the same time in fmod?

    - by Rootosaurus
    After reading documentation and tutorials about fmod I still have a question about frequency ranges. I've found how to get a frequency range using low and high pass DSP at the same time on the main channel, but I can't find how to get several ranges at the same time. For example I want, for a specific phase of my game, to hear range 400 to 600Hz and 1000 to 2000hz of the same sound. I tried to create a channel by range, but it doesn't seem to work (or maybe I do something wrong). How can I do that ? Thank you

    Read the article

  • ERROR! (Using Excel's named ranges from C#)

    - by mcoolbeth
    In the following, I am trying to persist a set of objects in an excel worksheet. Each time the function is called to store a value, it should allocate the next cell of the A column to store that object. However, an exception is thrown by the Interop library on the first call to get_Range(). (right after the catch block) Does anyone know what I am doing wrong? private void AddName(string name, object value) { Excel.Worksheet jresheet; try { jresheet = (Excel.Worksheet)_app.ActiveWorkbook.Sheets["jreTemplates"]; } catch { jresheet = (Excel.Worksheet)_app.ActiveWorkbook.Sheets.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing); jresheet.Visible = Microsoft.Office.Interop.Excel.XlSheetVisibility.xlSheetVeryHidden; jresheet.Name = "jreTemplates"; jresheet.Names.Add("next", "A1", true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); } Excel.Range cell = jresheet.get_Range("next", Type.Missing); cell.Value2 = value; string address = ((Excel.Name)cell.Name).Name; _app.ActiveWorkbook.Names.Add(name, address, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); cell = cell.get_Offset(1, 0); jresheet.Names.Add("next", ((Excel.Name)cell.Name).Name, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); }

    Read the article

  • Create chart using dynamic interactive ranges to select the series in Excel 2007

    - by jhc
    I would like to create a non-VBA based solution to the following question: How do I create a multi-series chart that will allow a user to select from a dropdown to change the data being graphed? I can do this already when the data series is contiguous; however, I'd like to be able to do it for non-contiguous data. Is this possible? My data look something like this: ID Salary Sal Min Sal Mid Sal Max Division Job Grade Job Subgrade Job XXX 10000 5000 15000 25000 North 13 1 Programmer XXX 12000 5000 15000 25000 North 13 1 Programmer XXX 14000 5000 15000 25000 South 13 1 Analyst XXX 11000 5000 15000 25000 South 13 1 Analyst XXX 20000 5000 15000 25000 North 14 1 Super Programmer XXX 25000 5000 15000 25000 North 14 1 Super Programmer XXX 22000 5000 15000 25000 North 14 1 Manager XXX 17000 5000 15000 25000 South 14 1 Manager XXX 19000 5000 15000 25000 South 14 1 Manager I would like to display Salary, Sal Min, Sal Mid, and Sal Max using a line graph. I would like the user to be able to select Job Grade, Division, and/or Job to determine what is charted. Is this possible? Would I somehow be able to do this if I used a pivottable or converted my data into a datatable? Thanks.

    Read the article

  • Regex statements for date ranges <=4/1/2009 and <=10/01/2009

    - by reggiereg
    Hi, I need serious help building two Regex statements for a project. The software we're using ONLY accepts Regex for validation. I need one that fires for any date <4/1/2009 and a second that fires for any date <10/1/2009 My co-worker gave me the following code to check for <=10/01/2010, but it checks leap years and all that stuff. I need something a little more streamlined than this in the MM/DD/YYYY format. Thanks in advance! ^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|.)(?:0?[1-9]|1\d|2[0-8])(\/|-|.)(?:2[0-9][2-9][0-9])$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|.)(?:0?[1-9]|1\d|2[0-8])(\/|-|.)(?:201[1-9])$|^(?:(?:(?:0?[13578]|1[02])(\/|-|.)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-|.)(?:29|30)))(\/|-|.)(?:201[1-9])$|^(?:(?:(?:11)(\/|-|.))(?:0?[1-9]|1\d|2[0-9]|30)(\/|-|.))(2010)$|^(?:(?:(?:10|12)(\/|-|.))(?:0?[1-9]|1\d|2[0-9]|30|31)(\/|-|.))(2010)$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|.)(?:0?[1-9]|1\d|2[0-8])(\/|-|.)(?:2[0-9][2-9][0-9])$|^(?:(?:(?:0?[13578]|1[02])(\/|-|.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|.)(?:29|30)))(\/|-|.)(?:2[0-9][2-9][0-9])$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|.)(?:0?[1-9]|1\d|2[0-8])(\/|-|.)(?:2011)$|^(?:0?2(\/|-|.)29\3(?:(?:(?:2[0-9][1-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$

    Read the article

  • Parameters and Ranges of Values

    - by Randy Minder
    I need to create a report in Crystal 2008 and I've haven't developed a report using Crystal in many years. When the user runs the report, I want them to be able to enter a start date and end date. I assume I can do this by using parameters. My question is this. Can I do this with a single parameter value or will it require two parameter values? Ideally what I would like to do is to allow the user to enter a start and end date in one parameter/prompt combination. Is this possible? Thanks - Randy

    Read the article

  • displaying data between date ranges mysql

    - by Kyle Hudson
    Hi Guys, I need to work out a period of 6 months (backwards) from a given date. Example date: 07/06/2010 00:00:00 needs to count back 6 months and display: 07/12/2009 00:00:00 I have been scanning through: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html and non of these functions make sense to me :( Hope this makes sense and any help would be appriciated. Kyle

    Read the article

  • jdbc query - date ranges as parameters

    - by pstanton
    Hi all, I'd like to write a single JDBC statement that can handle the equivalent of any number of NOT BETWEEN date1 AND date2 where clauses. By single query, i mean that the same SQL string will be used to create the JDBC statements and then have different parameters supplied. This is so that the underlying frameworks can efficiently cache the query (i've been stung by that before). Essentially, I'd like to find a query that is the equivalent of SELECT * FROM table WHERE mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? and at the same time could be used with fewer parameters: SELECT * FROM table WHERE mydate NOT BETWEEN ? AND ? or more parameters SELECT * FROM table WHERE mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? I will consider using a temporary table if that will be simpler and more efficient. thanks for the help!

    Read the article

  • Separating date ranges into separate segments in SQL

    - by Richard
    I have a table containing 2 date fields and an identifier (id, fromdate and todate) These dates overlap in any and every possible way. I need to produce a list of segments each with a start and end date describing the separate segments in that list. For example: id, FromDate ToDate 1, 1944-12-11, 1944-12-31 2, 1945-01-01, 1945-12-31 3, 1945-01-01, 1945-06-30 4, 1945-12-31, 1946-05-01 5, 1944-12-17, 1946-03-30 Should produce all the segments of all the overlaps: 1, 1944-12-11, 1944-12-16 1, 1944-12-17, 1944-12-31 5, 1944-12-17, 1944-12-31 2, 1945-01-01, 1945-06-30 3, 1945-01-01, 1945-06-30 5, 1945-01-01, 1945-06-30 2, 1945-07-01, 1945-12-09 5, 1945-07-01, 1945-12-09 2, 1945-12-10, 1945-12-31 4, 1945-12-10, 1945-12-31 5, 1945-12-10, 1945-12-31 4, 1946-01-01, 1946-03-30 5, 1946-01-01, 1946-03-30 4, 1946-04-01, 1946-05-01 Or perhaps a diagram might help INPUT 1 <----> 2 <-----------> 3 <-----> 4 <----------> 5 <-----------------> OUTPUT 1 <-> 1 <-> 5 <-> 2 <-----> 3 <-----> 5 <-----> 2 <-> 5 <-> 2 <-> 4 <-> 5 <-> 4 <-> 5 <-> 4 <----> Please help

    Read the article

  • Search for a date between given ranges - Lotus

    - by Kris.Mitchell
    I have been trying to work out what is the best way to search for gather all of the documents in a database that have a certain date. Originally I was trying to use FTsearch or search to move through a document collection, but I changed over to processing a view and associated documents. My first question is what is the easiest way to spin through a set of documents and find if a date stored in the documents is greater than or less than a specified date? So, to continue working I implemented the following code. If (doc.creationDate(0) > cdat(parm1)) And (doc.creationDate(0) < CDat(parm2)) then ... end if but the results are off Included! Date:3/12/10 11:07:08 P1:3/1/10 P2: 3/5/10 Included! Date:3/13/10 9:15:09 P1:3/1/10 P2: 3/5/10 Included! Date:3/17/10 16:22:07P1:3/1/10 P2: 3/5/10 You can see that the date stored in the doc is not between P1 and P2. BUT! it does limit the documents with a date less than P1 correctly. So I won't get a result for a document with a date less than 3/1/10 If there isn't a better way than the if statement, can someone help me understand why the two examples from above are included?

    Read the article

  • Complex Join - involving date ranges and sum...

    - by calumbrodie
    I have two tables that I need to join... I want to join table1 and table2 on 'id' - however in table two id is not unique. I only want one value returned for table two, and this value represents the sum of a column called 'total_sold' - within a specified date range (say one month).. SELECT ta.id, tb.total_sold as total_sold_this_week FROM table_a as ta LEFT JOIN table_b as tb ON ta.id=tb.id AND tb.date_sold BETWEEN ADDDATE(NOW(),INTERVAL -3 WEEK) AND NOW() this works but does not SUM the rows - only returning one row for each id... how do I get the sum from table b instead of only one row??? Please criticise if format of question could use more work - I can rewrite and provide sample data if required - this is a trivialised version of a much larger problem. -Thanks

    Read the article

  • SQL Server 2008: Using Multiple dts Ranges to Build a Set of Dates

    - by raoulcousins
    I'm trying to build a query for a medical database that counts the number of patients that were on at least one medication from a class of medications (the medications listed below in the FAST_MEDS CTE) and had either: 1) A diagnosis of myopathy (the list of diagnoses in the FAST_DX CTE) 2) A CPK lab value above 1000 (the lab value in the FAST_LABS CTE) and this diagnosis or lab happened AFTER a patient was on a statin. The query I've included below does that under the assumption that once a patient is on a statin, they're on a statin forever. The first CTE collects the ids of patients that were on a statin along with the first date of their diagnosis, the second those with a diagnosis, and the third those with a high lab value. After this I count those that match the above criteria. What I would like to do is drop the assumption that once a patient is on a statin, they're on it for life. The table edw_dm.patient_medications has a column called start_dts and end_dts. This table has one row for each prescription written, with start_dts and end_dts denoting the start and end date of the prescription. End_dts could be null, which I'll take to assume that the patient is currently on this medication (it could be a missing record, but I can't do anything about this). If a patient is on two different statins, the start and ends dates can overlap, and there may be multiple records of the same medication for a patient, as in a record showing 3-11-2000 to 4-5-2003 and another for the same patient showing 5-6-2007 to 7-8-2009. I would like to use these two columns to build a query where I'm only counting the patients that had a lab value or diagnosis done during a time when they were already on a statin, or in the first n (say 3) months after they stopped taking a statin. I'm really not sure how to go about rewriting the first CTE to get this information and how to do the comparison after the CTEs are built. I know this is a vague question, but I'm really stumped. Any ideas? As always, thank you in advance. Here's the current query: WITH FAST_MEDS AS ( select distinct statins.mrd_pt_id, min(year(statins.order_dts)) as statin_yr from edw_dm.patient_medications as statins inner join mrd.medications as mrd on statins.mrd_med_id = mrd.mrd_med_id WHERE mrd.generic_nm in ( 'Lovastatin (9664708500)', 'lovastatin-niacin', 'Lovastatin/Niacin', 'Lovastatin', 'Simvastatin (9678583966)', 'ezetimibe-simvastatin', 'niacin-simvastatin', 'ezetimibe/Simvastatin', 'Niacin/Simvastatin', 'Simvastatin', 'Aspirin Buffered-Pravastatin', 'aspirin-pravastatin', 'Aspirin/Pravastatin', 'Pravastatin', 'amlodipine-atorvastatin', 'Amlodipine/atorvastatin', 'atorvastatin', 'fluvastatin', 'rosuvastatin' ) and YEAR(statins.order_dts) IS NOT NULL and statins.mrd_pt_id IS NOT NULL group by statins.mrd_pt_id ) select * into #meds from FAST_MEDS ; --return patients who had a diagnosis in the list and the year that --diagnosis was given with FAST_DX AS ( SELECT pd.mrd_pt_id, YEAR(pd.init_noted_dts) as init_yr FROM edw_dm.patient_diagnoses as pd inner join mrd.diagnoses as mrd on pd.mrd_dx_id = mrd.mrd_dx_id and mrd.icd9_cd in ('728.89','729.1','710.4','728.3','729.0','728.81','781.0','791.3') ) select * into #dx from FAST_DX; --return patients who had a high cpk value along with the year the cpk --value was taken with FAST_LABS AS ( SELECT pl.mrd_pt_id, YEAR(pl.order_dts) as lab_yr FROM edw_dm.patient_labs as pl inner join mrd.labs as mrd on pl.mrd_lab_id = mrd.mrd_lab_id and mrd.lab_nm = 'CK (CPK)' WHERE pl.lab_val between 1000 AND 999998 ) select * into #labs from FAST_LABS; -- count the number of patients who had a lab value or a medication -- value taken sometime AFTER their initial statin diagnosis select count(distinct p.mrd_pt_id) as ct from mrd.patient_demographics as p join #meds as m on p.mrd_pt_id = m.mrd_pt_id AND ( EXISTS ( SELECT 'A' FROM #labs l WHERE p.mrd_pt_id = l.mrd_pt_id and l.lab_yr >= m.statin_yr ) OR EXISTS( SELECT 'A' FROM #dx d WHERE p.mrd_pt_id = d.mrd_pt_id AND d.init_yr >= m.statin_yr ) )

    Read the article

  • Date ranges intersections..

    - by Puzzled
    MS Sql 2008: I have 3 tables: meters, transformers (Ti) and voltage transformers (Tu) ParentId MeterId BegDate EndDate 10 100 '20050101' '20060101' ParentId TiId BegDate EndDate 10 210 '20050201' '20050501' 10 220 '20050801' '20051001' ParentId TuId BegDate EndDate 10 300 '20050801' '20050901' where date format is yyyyMMdd (year-month-day) Is there any way to get periods intersection and return the table like this? ParentId BegDate EndDate MeterId TiId TuId 10 '20050101' '20050201' 100 null null 10 '20050201' '20050501' 100 210 null 10 '20050501' '20050801' 100 null null 10 '20050801' '20050901' 100 220 300 10 '20050901' '20051001' 100 220 null 10 '20051001' '20060101' 100 null null Here is the table creation script: --meters declare @meters table (ParentId int, MeterId int, BegDate smalldatetime, EndDate smalldatetime ) insert @meters select 10, 100, '20050101', '20060101' --transformers declare @ti table (ParentId int, TiId int, BegDate smalldatetime, EndDate smalldatetime ) insert @ti select 10, 210, '20050201', '20050501' union all select 10, 220, '20050801', '20051001' --voltage transformers declare @tu table (ParentId int, TuId int, BegDate smalldatetime, EndDate smalldatetime ) insert @tu select 10, 300, '20050801', '20050901'

    Read the article

  • Define integer ranges in C

    - by maddy
    Hi, I want to define a type named Int_1_100_Type which is an integer variable in the range from 1 to 100. How should i typedef this one? for eg: i am passing this variable to a function which accepts variable of type Int_1_100_Type. i.e funca(Int_1_100_Type Var1) Thanks Maddy

    Read the article

  • How to find date ranges in records with consecutive dates and duplicate data

    - by alan s
    There's probably any easy solution for this, but I can't see it. I have a table with consecutive dates and often duplicate associated data for several of these consecutive dates: Date Col1 Col2 5/13/2010 1 A 5/14/2010 1 A 5/15/2010 2 B 5/16/2010 1 A 5/17/2010 1 A 5/18/2010 3 C 5/19/2010 3 C 5/20/2010 3 C Using MS T-SQL, I wish to find the start and end dates for each run of distinct Col1 and Col2 values: StartDate EndDate Col1 Col2 5/13/2010 5/14/2010 1 A 5/15/2010 5/15/2010 2 B 5/16/2010 5/17/2010 1 A 5/18/2010 5/20/2010 3 C Assumptions: There are never any missing dates. Col1 and Col2 are not null. Any ideas - preferably that don't use cursors? Many thanks, -alan

    Read the article

  • Combining consecutive dates into ranges

    - by Ragha J
    I have a List of objects public class sample { public DateTime Date; public string content; } I want to be able to create a list of new objects public class sampleWithIntervals { public DateTime startDate; public DateTime endDate; public string content; } The sample objects should be grouped into intervals based on the content. The intervals can include only those dates that are included in the original sample list. I dont know how to do this in Linq. Sample data: {"10/1/2013", "x"} {"10/2/2013", "x"} {"10/2/2013", "y"} {"10/3/2013", "x"} {"10/3/2013", "y"} {"10/10/2013", "x"} {"10/11/2013", "x"} {"10/15/2013", "y"} {"10/16/2013", "y"} {"10/20/2013", "y"} This should give me {"10/1/2013","10/3/2013", "x"} {"10/2/2013","10/3/2013", "y"} {"10/10/2013","10/11/2013", "x"} {"10/15/2013","10/16/2013", "y"} {"10/20/2013","10/20/2013", "y"}

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >