Saving data in a SQL Server 2016 database for a specfic report

烈酒焚心 提交于 2020-02-07 03:50:06

问题


I was not sure how to title this but let me explain. I need to pull all of the publication article ID's from PubMed for every member of a Cancer Center. The ID's are normally 6 or 7 digest long. Currently I'm using a Stored Proc to save the id's in a comma separated string with the email address is the unique ID for the member.

INSERT INTO [dbo].[ADMIN_Publications] ([Organization], [email], [PMID])
VALUES (@Organization, @Email, @PMID, )

The PMID's could be like

23579449,25465297,26512957,29092960,20303407,20411915,23424282

I could have 1000 members with about 100 publications each but the closer number would be about 125 members with an average of 50 publications each.

Saving the data is not the problem. The problem is that after I pull all of the members publications I need to display the data with the PMID that is stored with the most Members in a descending count.

Such as

          a@med.edu, c@med.edu, k@med.edu
          20411915

then the next

          j@med.edu, c@med.edu, g@med.edu
          29092960

Storing the data as a comma separated string makes it tough to get out, unless someone has a secret. Should I save each PMID separately with the ID email? So I would have another table that have just the email and the PMID and I would query off of that table. Is there a better way?

Thanks

来源:https://stackoverflow.com/questions/50498610/saving-data-in-a-sql-server-2016-database-for-a-specfic-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!