Viewing 15 posts - 31 through 45 (of 47 total)
DECLARE @tab char(1) = char(9)
EXEC msdb.dbo.sp_send_dbmail
@recipients='xxxx@xxxx.com'
@subject= 'Inventory',
@query= 'SET NOCOUNT On;
SELECT "Item" AS Item_id
, "Qty" AS qty_on_hand
, "Acct" AS acct
, "Date" AS date_entered;
SELECT RTRIM(j.item_id)
, j.qty_on_hand
, j.acct
, j.date_entered
FROM...
June 7, 2016 at 7:30 am
Thank you's to both Lynn Pettis and pietlinden. I had tried the nested query but obviously didn't have it correct. I hadn't even thought about the row_number. Both methods work...
March 2, 2016 at 4:59 pm
I assume you mean like this? I appreciate the guidance.
SELECT id
, CASE
WHEN L1 > L2 AND L1 > L3 THEN L1
WHEN L2 > L1 AND L2 > L3 THEN...
January 18, 2016 at 2:25 pm
Fantastic. Know I know how to post better code when I need help again. Thanks.
July 8, 2015 at 11:44 am
Luis Cazares (7/8/2015)
I also changed the pivot approach to a cross tabs...
July 8, 2015 at 11:33 am
Lynn Pettis (7/8/2015)
jcobb 20350 (7/8/2015)
July 8, 2015 at 11:25 am
In all the posts, I completely missed the solution posted by LinksUp. This works great. Thanks so much.
June 29, 2015 at 1:25 pm
Lynn Pettis (6/29/2015)
jcobb 20350 (6/29/2015)
Lynn Pettis (6/29/2015)
jcobb 20350 (6/29/2015)
J Livingston SQL (6/29/2015)
I have a table that writes daily sales each night but it adds the day's sales to the cumulative...
June 29, 2015 at 12:25 pm
Lynn Pettis (6/29/2015)
jcobb 20350 (6/29/2015)
J Livingston SQL (6/29/2015)
I have a table that writes daily sales each night but it adds the day's sales to the cumulative total for the month
why...
June 29, 2015 at 11:56 am
J Livingston SQL (6/29/2015)
I have a table that writes daily sales each night but it adds the day's sales to the cumulative total for the month
why dont you just query...
June 29, 2015 at 11:24 am
Correct in assuming SQL2008. I hope to be on 2014 by year end.
I don't think LEAD LAG is quite the answer though. I looked at Pinal Dave's page and...
June 29, 2015 at 9:14 am
Fantastic. I need to read up and understand the PARTITION BY a little more, but this did exactly what I needed. This is a snippet of what will be in...
February 13, 2015 at 12:41 pm
That's what I'm looking for. Wow. Now to digest it a little so I can implement. Thanks so much. I would not have figured this out without help.
March 4, 2014 at 10:09 am
Here's a create table with an insert for the same sample data as earlier.
CREATE TABLE sample_sales
(customer_id varchar(8) not null
, period decimal(3,0) null
, year_for_period decimal (4,0) null
, total_amount decimal(19,4) not...
March 4, 2014 at 9:53 am
You're right, I don't think I need the period or year in my return because then I get muliple lines of return. What I have is a table of sales...
March 4, 2014 at 9:03 am
Viewing 15 posts - 31 through 45 (of 47 total)