Hi, I have SQL 2008 table like
SiteID TotalBeds AdmissionDate DischargeDate
01 10 2010-08-01 NULL
01 10 2010-08-02 2010-08-05
01 10 2010-08-02 NULL
01 10 2010-08-02 NULL
01 10 2010-08-02 NULL<
View Complete Post
I'm building a report in Crystal Reports using a SQL command against a T-SQL 2005 telephony database.
I need to be able to run the query across a given datetime range, 6 months for example and bring back a 5 day display (Mon-Fri) with a group for every 15 minute interval in each day.
The group figures need to contain an average of the amount of calls presented for each 15 minute interval on any day across the whole datetime range, so for example the Monday 10:00 - 10:15 figure would be an average of all calls presented in every 10:00-10:15
range on each of the Mondays that fall within the datetime range.
I've got a query built now that gives total presented figures grouped by these intervals across one week but I can't figure out how to do this average function across a range.
Does anyone have any idea how I'd go about accomplishing this? I'm pretty new to SQL but keen to learn so any pointers on functions to research etc would be very much appreciated.
Thanks alot in advance, Andy.
Query for detail view across one week included below for table/fields etc...
count(DISTINCT Calls.SessionID) as Presented, min(Calls.startDateTime) as DateTime
INNER JOIN QueueDetail
ON Calls.sessionID = Queues.sessionID
AND Calls.sessionSeqNum = QueueDet
I have no clue why my query is acting weird
If i try to run it for 1/1/2010 9/30/2010 the query takes around 1min 26 sec and return around a million rows
and If i run for 8/1/2010 to 8/31/2010 it takes forever to it...
basically i am getting data from 5 tables and putting it in a temp table and then updating that temp table 2-3 times with some information and then displaying it.
I am stumped as to why it works fast for a longer date range and runs the snail for a small period of time..
I am in the verge of pulling my hair and going crazy..
any help will be appreciated.
can any one help me out...why am getting "data type mis match error"
DateTime dFromDate = dt_From.Value;
dt_From.Value = DateTime.Parse(dFromDate.ToShortDateString());
string From = dFromDate.ToShortDateString();
DateTime dToDate = dt_To.Value;
dt_To.Value = DateTime.Parse(dToDate.ToShortDateString());
string To = dToDate.ToShortDateString();
OleDbConnection cn = new OleDbConnection(ConfigurationSettings.AppSettings["connec"]);
OleDbDataAdapter da = new OleDbDataAdapter("select * from Route_Expenses a where Entry_Date between '" +From+"' and '"+To+"'",cn);
DataSet ds = new DataSet();
dataGridView1.DataSource = ds.Tables;
I am pulling the data into a column as XML data type and I want to query within the below XML that is returned.
I want to construct XPATH that allows me to search for a date range where Field Name = Review Date. I want records to be returned whenever the Review Date falls within a date range that I am passing from the UI
<tr2 fieldcode="23" fieldvalue="Periodic Review">
<LF FieldName="Request Type" />
<tr2 fieldcode="26" fieldvalue="05/04/2010">
<LF FieldName="Review Date" />
<LF FieldName="Total Number of Accounts" />
<LF FieldName="Total Number of Roles" />
<tr2 fieldcode="27" fieldvalue="28">
<tr2 fieldcode="28" fieldvalue="252">
I have a table containing courses, columns are
Name - "Yoga Classes"
DateStart - "2/23/2010"
DateEnd - "2/24/2010"
I am using ListView Control to bind it, is there a way to display them and group them by Month?
Piano Class (10th Jan 2010 - 11th Jan 2010)Guitar Class (10th Jan 2010 - 11th Jan 2010)
Yoga Class (15th Feb 2010 - 16th Feb 2010) etc...
Thanks for help.