Viewing 15 posts - 436 through 450 (of 466 total)
A cte would get you what you need I believe.
;with cte as(
Select count(distinct i.inv_NUMBER) as "number of Invoices", round(SUM(line_units * line_price), 2)as "Invoice Total"
from line l
join invoice i
on l.inv_number =...
January 23, 2012 at 3:42 pm
I believe your join to the invoice table is wrong. You have on l.inv_number = l.inv_number. You should have on l.inv_number = i.inv_number
January 23, 2012 at 11:35 am
Wait, try this in the where clause:
where data like '%[[]ss]%'
January 23, 2012 at 9:09 am
Boy, it is too early in the morning for me. I didn't even realize this was the 2000 board. D'oh. I don't know of anything off the...
January 23, 2012 at 9:06 am
Shoot, you are right, sorry about that. How about this?
DECLARE @t TABLE (Data VARCHAR(30))
INSERT @t (Data) VALUES
('abcssdef'),
('abc[ss]def'),
('abc[70ps]def')
select * from @t
where data like '%\[ss\]%' escape '\'
January 23, 2012 at 8:41 am
DECLARE @t TABLE (Data VARCHAR(30))
INSERT @t (Data)
VALUES ('abcssdef'),
('abc[ss]def')
select * from @t
where data like '%[[ss]]%'
January 23, 2012 at 8:27 am
I am confused here, are you just confused on the math and not the SQL code? If so, to calculate the percentage of each company's amount, you would take...
January 20, 2012 at 1:13 pm
I too am confused if you want unknown in the total or not. If you do, you could do something like this:
DECLARE @t TABLE (companyname VARCHAR(10), amount int)
INSERT @t
VALUES...
January 20, 2012 at 11:24 am
You can just join to a permanent numbers/tally table that can be as large as you need it. Jeff Moden's is probably 10 million, mine is 10k.
Ya, on my...
January 19, 2012 at 9:25 am
I guess my only complaint is that you would have a problem if the text string was longer than 2048 characters. I suppose that could be fixed with a...
January 19, 2012 at 9:20 am
I can't seem to quote messages in my replys for some reason, but holy cow Mark, that is way more elegant than the tally table solution I had come up...
January 19, 2012 at 9:10 am
Not really clear on what you are asking, but
select round(yourField, 0)
from yourTable
???
January 18, 2012 at 3:19 pm
Or something like this if he wants the start and end date of the quarter.
SELECT
convert(date, DATEADD(q, DATEDIFF(q,0,GETDATE()),0)) FirstQDate,
convert(date, DATEADD(s,-1,DATEADD(q, DATEDIFF(q,0,GETDATE())+1,0))) LastQDate
Woops, I made the same mistake as bitbucket, lol, this...
January 17, 2012 at 10:38 am
Use the same code I had in my first post here:
select * from yourTable
where Last_Name like '%[^a-z]%'
but instead put a space after the z:
select * from yourTable
where Last_Name like...
January 17, 2012 at 8:28 am
It does get a little confusing with like, not like, and the ^ sign. My best suggestion would be to make a temp table with some examples of last...
January 16, 2012 at 10:00 am
Viewing 15 posts - 436 through 450 (of 466 total)