Orderdating powered by vbulletin ru thedatingchat com

I want each entry to be the number of transactions in the column month with the row company.

Also a 13th column with the total for the year for the company, and a final row with the total for the column month across all companies.

To me, the logical thing would be that the model translated the field back to time stamp due to the date format 'time'. How do I set which date format to use when PUT'ing ans POST'ing back? If it's a native form post, I don't know if you can customize the format that much.

If you're using the model's proxy, then it should post back using the format you defined in your model definition. I find it strange that the proxy or model don't handle the date format in both directions when using the .save() method on the model.

Simple little spreadsheet, but I can't figure out how to get there. GROUP BY Company and SELECT COUNT(Transaction number) will give me one column with all the transactions of the company ever. thanks in advance Peso has written a very fine function that should do the trick for you.

I really need a count function which counts only those matching some month. I've been able to use it for a number of date interval/period queries and calculations.

can do some things with "GROUPING" (not included below) to make the subtotals and totals more apparent but, considering you posted no schema nor data, this should get you started once you make the appropriate substitutions for table and column names as required... Company, d.[Year], SUM(CASE WHEN [Month] = 01 THEN Transactions ELSE 0 END) AS Jan, SUM(CASE WHEN [Month] = 02 THEN Transactions ELSE 0 END) AS Feb, SUM(CASE WHEN [Month] = 03 THEN Transactions ELSE 0 END) AS Mar, SUM(CASE WHEN [Month] = 04 THEN Transactions ELSE 0 END) AS Apr, SUM(CASE WHEN [Month] = 05 THEN Transactions ELSE 0 END) AS May, SUM(CASE WHEN [Month] = 06 THEN Transactions ELSE 0 END) AS Jun, SUM(CASE WHEN [Month] = 07 THEN Transactions ELSE 0 END) AS Jul, SUM(CASE WHEN [Month] = 08 THEN Transactions ELSE 0 END) AS Aug, SUM(CASE WHEN [Month] = 09 THEN Transactions ELSE 0 END) AS Sep, SUM(CASE WHEN [Month] = 10 THEN Transactions ELSE 0 END) AS Oct, SUM(CASE WHEN [Month] = 11 THEN Transactions ELSE 0 END) AS Nov, SUM(CASE WHEN [Month] = 12 THEN Transactions ELSE 0 END) AS [Dec], SUM(Transactions) AS Total, SUM(Transactions)/24 AS Average FROM (--Derived table "d" finds count for year and month SELECT Company, [Year] = DATEPART(yy, Transaction Date), [Month] = DATEPART(mm, Transaction Date) Transactions = COUNT(*) FROM yourtable GROUP BY Company, DATEPART(yy, Transaction Date), DATEPART(mm, Transaction Date) ) d GROUP BY d. Company, d.[Year] ...and, in a properly indexed environment, will process millions of rows in scant seconds (ie. --Jeff Moden Hi Jeff- That was a really cool SQL example.

Much more sophisticated than anything I was trying. I read some pages on the internet to try to understand what it does, but it's kind of moot; I couldn't get my server to accept any of my WITH ROLLUP examples (including the one you posted).

I'm querying data with joins that I've created and would be something along the lines of: Person ID, Order Count, Sales Total, Week No, Year The Tsql being: Select Person ID, Person Catagory, count(table B. Revenue) as Sales Total, Week(orderdate), Year(orderdate) from table A Right Join table B on person ID = client ID Where Person Category = 'GG' Group By Person ID Having Week = '10' and Year = '2017' The above works fine (sorry if anything is slightly incorrect there, I'm not in front of my computer) However, I'm looking at adding in the sum of 2017-01-01 to current year and week number. Sales Total This Year, Week(orderdate), Year(orderdate) from table A a inner join (Select Person ID, Sum(table B. Sales Total This Year, Week(orderdate), Year(orderdate) from table A a inner join (Select Person ID, Sum(table B.

I tried a sub query at the end but this didn't seem to work. Revenue) as Sales Total This Year from table A Right Join table B on person ID = client ID Where Person Category = 'GG' Group By Person ID Having Year = '2017') as AA on a. Person ID Right Join table B on person ID = client ID Where Person Category = 'GG' Group By Person ID Having Week = '10' and Year = '2017'Select Person ID, Person Catagory, count(table B. Revenue) as Sales Total This Year from table A Right Join table B on person ID = client ID Where Person Category = 'GG' Group By Person ID Having Year = '2017') as AA on a. Person ID Right Join table B on person ID = client ID Where Person Category = 'GG' Group By Person ID Having Week = '10' and Year = '2017'Wow, I thought I was fairly confident with tsql until I saw this!

does anyone have a working example of calling sp_executesql passing a datetime parameter? I even tried passing the datetime as a string but keep getting an error on converting a varchar to a datetime.

Tags: , ,