Viewing 15 posts - 3,616 through 3,630 (of 10,144 total)
Replace EXEC @QUERY with PRINT @QUERY and post the resulting message here.
February 21, 2014 at 6:50 am
This will work with your "sample" data.
-- sample data
DROP TABLE #Whatnot
CREATE TABLE #Whatnot (company_name int, product_id int, product_name varchar(10))
INSERT INTO #Whatnot VALUES
(1,1,'oi'),
(1,1,'oi2'),
(1,2,'teste'),
(2,1,'oi3')
-- solution
SELECT
company_name,
col1 = MAX(CASE WHEN...
February 21, 2014 at 6:48 am
rodjkidd (2/21/2014)
ChrisM@Work (2/21/2014)
SQLRNNR (2/20/2014)
ChrisM@Work (2/20/2014)
SQLRNNR (2/20/2014)
Sean Lange (2/20/2014)
stormsentinelcammy (2/20/2014)
will this forum thread ever get back on topic?What topic is that???
SQUIRREL
NUTS! WHOLE HAZELNUTS!! Careful, this could go downhill very quickly...
You still...
February 21, 2014 at 5:30 am
GilaMonster (2/20/2014)
February 21, 2014 at 3:42 am
SQLRNNR (2/20/2014)
ChrisM@Work (2/20/2014)
SQLRNNR (2/20/2014)
Sean Lange (2/20/2014)
stormsentinelcammy (2/20/2014)
will this forum thread ever get back on topic?What topic is that???
SQUIRREL
NUTS! WHOLE HAZELNUTS!! Careful, this could go downhill very quickly...
You still work in...
February 21, 2014 at 3:40 am
mattech06 (2/21/2014)
One question tho, why did you add?
AND (r.dbStaffLastName IS NULL...
February 21, 2014 at 3:08 am
mattech06 (2/21/2014)
good point, but how do I join them?
How can you possibly code against these tables without knowing what the relationships are between them?
1. Ask your DBA
2. Study the...
February 21, 2014 at 2:52 am
Your query employs a scary mix of old-style and new-style joins which can be very confusing. There's some evidence for this - you've omitted the join between two of your...
February 21, 2014 at 2:00 am
SQLRNNR (2/20/2014)
Sean Lange (2/20/2014)
stormsentinelcammy (2/20/2014)
will this forum thread ever get back on topic?What topic is that???
SQUIRREL
NUTS! WHOLE HAZELNUTS!! Careful, this could go downhill very quickly...
February 20, 2014 at 9:49 am
Luis Cazares (2/20/2014)
sqldba20 (2/20/2014)
Nevermind...I was able to figure out using the link posted by Luis. Came with this SQL and it works.
How on earth did you figure that out from...
February 20, 2014 at 9:46 am
sqldba20 (2/20/2014)
It is only for display purpose in reporting because the user doesn't want to see 4 rows for each record if there are 4 email ids for that AID.
You...
February 20, 2014 at 8:53 am
serg-52 (2/20/2014)
Then JOIN themselect x.R1,x.R2,x.R3, y.C1,y.C2,y.C3
from Database.table1 as x
join Database.table2 as y
to get all possible combinations aka cartesian product.
Restrict combinations using WHERE clause
http://technet.microsoft.com/en-us/library/ms191517(v=sql.105).aspx
On its own, join will raise an...
February 20, 2014 at 5:49 am
Thanks for posting readily-consumable data, great job. I prefer working with #temp tables and it only took moments to convert your script.
Figuring out how to filter unwanted rows in this...
February 20, 2014 at 3:11 am
SQLRNNR (2/19/2014)
Yay - I'm finally insane!!! :hehe::w00t:
Most of those points were insanely well earned, congratulations Jason.
February 20, 2014 at 1:53 am
ElijahE (2/19/2014)
Yea, I checked that, and it's still set as GO
ChrisM@Work (2/19/2014)
Have you tried a proper simple query to see if it's the batch separator causing the problem?
SELECT 1GO
SELECT 1
GO
February 19, 2014 at 8:53 am
Viewing 15 posts - 3,616 through 3,630 (of 10,144 total)