Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jgeorge
Starting Member
6 Posts |
Posted - 2015-03-25 : 17:33:22
|
I have more than 720000 lines when I execute the following sql, There are only 2200 of the 'name' but each name associated with multiple code/levelcode etc. Is there a way that I can insert one code/LevelCode/HL7Code to each 2000 names ?---------------------------------------------------------------------select distinct ocmi.name [name] , cit.active [taskactive],Code,LevelCode,HL7CodeFROM cv3ordercatalogmasteritem ocmileft join cv3catalogitemtask citon ocmi.guid=cit.ordercatalogmasteritemguidLEFT JOIN CV3CatalogTaskLocationXRef tasklocxrefon cit.guid=tasklocxref.CatalogItemTaskGUIDjoin cv3location lon l.guid=tasklocxref.LocationGroupGUIDWHERE ocmi.active=1 and ocmi.name not like 'zz%'and ocmi.name not like 'qq%'and ocmi.name <> 'refill'and ocmi.name not like 'qa%'and ocmi.name not like 'Saline Lock%'/*select ocmi.namefrom cv3ordercatalogmasteritem ocmileft JOINCV3OrganizationalUnit ouON ocmi.orgunitguid = ou.guidwhere ou.name = 'Pharmacy'and ou.active=1and ocmi.name not like 'zz%'and ocmi.name not like 'qq%'and ocmi.name <> 'SK RX UOMTEST'and ocmi.name <> 'SKStylenol'and ocmi.name <> 'refill'and ocmi.name not like 'qa%'and ocmi.active=1*/order by ocmi.Name |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-03-25 : 20:19:18
|
Show us some sample data and expected output.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
jgeorge
Starting Member
6 Posts |
Posted - 2015-03-26 : 10:47:08
|
Name Taskactive Code Level Code HL7Code bacitracin sterile powder 1 PLC|Emergency |PLC ED |Main WR Main WR PLC |PLC ED |MAIN WR | bacitracin sterile powder 1 SHC|.Inpatient|SHCICUB| SHCICUB SHC|SHCICUB ||For each name there are 650 plus rows and there are 2200 plus names. I would like to insert one distinct Code,Levelcode,HL7Code for each of the 2200 plus names. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-03-26 : 12:56:34
|
We need to see sample data AND expected output.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
jgeorge
Starting Member
6 Posts |
Posted - 2015-03-26 : 14:46:39
|
While executing the query , I am getting the output as mentioned, It is the sample data. This is the select query and I need to insert some more values to these tables, as mentioned, with a different code/level Code/HL7 Code |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-03-26 : 14:47:09
|
Here is how to post the needed information: http://www.sqlservercentral.com/articles/Best+Practices/61537/Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-03-26 : 14:47:53
|
And if you aren't a user of SQL Server Central, then signup so you can read the article.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|
|
|