Viewing 8 posts - 1 through 8 (of 8 total)
We have a winner!
declare @vehicle table(id int, vehiclemake varchar(10), vehiclemodel varchar(10))
declare @vehicleclass table(id int, vehiclemake varchar(10), vehiclemodel varchar(10), classtype varchar(1))
insert into @vehicle values(1, 'AUDI', 'R8')
insert into @vehicle values(2, 'AUDI', 'Quattro')
insert...
April 9, 2015 at 8:17 am
Yeah, I know the problems with nulls. What I'm trying to do is have a 'catch all' record.
So in my example, I'm interested in Audi R8 and Audi Quattro,...
April 9, 2015 at 7:18 am
Update:
ok, I changed my first join so that it was:
left join #vehicleclass vc on v.vehiclemake = vc.vehiclemake and isnull(v.vehiclemodel, '') = isnull(vc.vehiclemodel, '')
But then if I add another record to...
April 9, 2015 at 6:37 am
Ok - here's a better example:
create table #vehicle(id int, vehiclemake varchar(10), vehiclemodel varchar(10))
create table #vehicleclass(id int, vehiclemake varchar(10), vehiclemodel varchar(10), classtype varchar(1))
create table #class(id int, classtype varchar(1), value int)
insert into...
April 9, 2015 at 6:30 am
Hi - I only want 1 record returned.
So if the model is 'R8' it will return the A class type record, and if the model is anything else it will...
April 9, 2015 at 5:57 am
Perfect - works a treat. Amended it to fit my data set, even expanded it for a few more groups and voila.
Nice one, very much appreciated!
November 7, 2014 at 4:57 am
Oki doki - let me give that a try and see what happens!
Thanks for suggesting something....
November 7, 2014 at 3:47 am
I may not have explained myself properly
If I just want the sum per hour and join to my numbers table I get what I want:
hour ...
November 7, 2014 at 1:53 am
Viewing 8 posts - 1 through 8 (of 8 total)