September 19, 2018 at 9:19 am
How can I combine all the dates from #VISITS to each provider in #PROVIDER?
create table #VISITS
(
VisitDate datetime
)
insert into #VISITS(VisitDate) values('10/31/2017')
insert into #VISITS(VisitDate) values('11/30/2017')
insert into #VISITS(VisitDate) values('12/31/2017')
insert into #VISITS(VisitDate) values('01/31/2018')
insert into #VISITS(VisitDate) values('02/28/2018')
insert into #VISITS(VisitDate) values('03/31/2018')
insert into #VISITS(VisitDate) values('04/30/2018')
insert into #VISITS(VisitDate) values('05/31/2018')
insert into #VISITS(VisitDate) values('06/30/2018')
insert into #VISITS(VisitDate) values('07/31/2018')
insert into #VISITS(VisitDate) values('08/31/2018')
insert into #VISITS(VisitDate) values('09/30/2018')
insert into #VISITS(VisitDate) values('10/31/2017')
insert into #VISITS(VisitDate) values('11/30/2017')
insert into #VISITS(VisitDate) values('12/31/2017')
insert into #VISITS(VisitDate) values('01/31/2018')
insert into #VISITS(VisitDate) values('02/28/2018')
insert into #VISITS(VisitDate) values('03/31/2018')
insert into #VISITS(VisitDate) values('04/30/2018')
insert into #VISITS(VisitDate) values('05/31/2018')
insert into #VISITS(VisitDate) values('06/30/2018')
insert into #VISITS(VisitDate) values('07/31/2018')
insert into #VISITS(VisitDate) values('08/31/2018')
insert into #VISITS(VisitDate) values('09/30/2018')
create table #PROVIDERS
(
Provider varchar(100)
)
insert into #PROVIDERS(Provider) values('ADIGUN P.A.,MELISSA')
insert into #PROVIDERS(Provider) values('BOGAL N.P.,CAROLYN')
insert into #PROVIDERS(Provider) values('CARDIAC ECHO')
insert into #PROVIDERS(Provider) values('EHRENZWEIG P.A.,SHELDON')
insert into #PROVIDERS(Provider) values('EYE SERVICE TESTS')
insert into #PROVIDERS(Provider) values('FILLER M.D.ELIZABETH')
insert into #PROVIDERS(Provider) values('FUKUDOME M.D.,EUGENE')
insert into #PROVIDERS(Provider) values('HOLTERS')
insert into #PROVIDERS(Provider) values('LEIMAN M.D.,DAVID')
insert into #PROVIDERS(Provider) values('MCCORMACK LICSW,ELAINE')
insert into #PROVIDERS(Provider) values('MEYER PHD,JOSEPH F.')
insert into #PROVIDERS(Provider) values('NAHILL N.P.,ELISABETH')
insert into #PROVIDERS(Provider) values('NEURO TEST')
insert into #PROVIDERS(Provider) values('NON STRESS')
insert into #PROVIDERS(Provider) values('ONYSKIV M.D.,MARTA')
insert into #PROVIDERS(Provider) values('PACER CHECKS')
insert into #PROVIDERS(Provider) values('PHOTO THERAPY')
insert into #PROVIDERS(Provider) values('RUPAREL M.D.,MEERA')
insert into #PROVIDERS(Provider) values('STRESS TEST')
September 19, 2018 at 9:40 am
What is the desired output?
😎
There is no obvious relationship within the data sets, the best you could get from this is a Cartesian produce of the two sets.
September 19, 2018 at 9:51 am
That may be what he wants. Do a CROSS JOIN between the two tables.
September 19, 2018 at 9:57 am
What result set are you looking for?
September 19, 2018 at 10:37 am
Two columns. Provider and VisitDate. Each provider would be listed 12 times with the visit dates in the other column.
September 19, 2018 at 10:41 am
NineIron - Wednesday, September 19, 2018 10:37 AMTwo columns. Provider and VisitDate. Each provider would be listed 12 times with the visit dates in the other column.
Really not that hard.
select *
from
#Provider
cross join #Visits;
September 19, 2018 at 10:47 am
Wonderful. Thanx.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply