I am trying to write a ranking match / search system for a client who has requested content (matitue test) And providers (where userprofile.usertype_id = 1) can provide content (s) and rank those ranks which can provide the highest, or all content. Here is the database schema I:
User Profiles table request table materials spacing table content provider table Table of Contents For example, if I have this request: and these materials were requested from and had a population like content provider I am expecting to look like my output Where column names are obtained from the content in the request. Then be able to find providers who can provide more than one percent of the requested content. Is there a better way to do this? The process takes a lot of time and wants to do better / best practice about how to write something like this. "post-text" itemprop = "text">
userprofile_id int identity userprofile_dt datetime first_nm varchar (50) last_nm varchar (50) usertype_id int (Provider = 1, requester = 2)
request_id applicant identity request _ dt datetime title varchar (50 ) Description Varchar (100) userprofile_id int (where usertype = 2)
Samgri_rek_aid ITI identified request_id int Content_id int
Samgri_pru_aidi IIT Upyogkrtaprofail_ id Int (where Ugrtep = 1) content_id int
material_id int identity Samgri_desk Varchar (50)
request_id = 1 request_dt = 3/28/2011 title = 'test request 'desc = null userprofile_id = 100 (wh enabling Ugrtepe_aid = 2)
material_req_id request_id content_loc id 1 1 10 ( Steel) 2 1 11 (copper) 3 1 12 (titanium) 4 1 13 (n
content_pro_id userprofile_id content_ id 1 2 10 (steel) 2 2 11 (copper) 3 2 13 (nickel) ) 4 3 11 (copper) 5 3 13 (nickel) 6 3 12 (titanium)
userprofile_id Steel copper nickel titanium pct_match 2 YYYN 75 3 NYYY 75
; As General output (/ * Normal output per line content * / SELECT p.userprofile_id, m.material_desc, value = case when mp.material_pro_id IS NULL 'N' ELSE 'Y' end request r INNER JOIN MATERIALRequest mr oN r.request_id = mr.request_id INNER JOIN content meter oN mr.material_id = m.material_id CROSS JOIN (select different MaterialProvider userprofile_id) p LEFT JOIN MaterialProvider mp oN p.userprofile_id = mp.userprofile_id and mr Material_id = mp.material_id WHERE r.request_id = 1) SELECT p *, T.pct_match FROM (/ * Normal output * / selectable userprofile_id, general, optical N PIVOT (maximum (value) from steel, copper, titanium, nick) Content_desk IN (steel, copper, titanium, nickel)) P INNER (collect / normal output) (calculation of percents) * / SELECT userprofile_id, Pct_match = COUNT (case value when 'y' then value AD) * 100 / COUNT (*) from userProfile_ID by normaloutput group) * Two revised Join the output * / ON t.userprofile_id = p.userprofile_id
Comments
Post a Comment