Hirdetés
Új hozzászólás Aktív témák
-
tm5
tag
válasz
Apollo17hu
#5468
üzenetére
Hát én valamni ilyesmivel indítanék:
select t.*, ROW_NUMBER() OVER(PARTITION BY t.id ORDER BY t.match_rate desc) AS row_num2
from
(select
t1.id
,t2.kategoria
,
(case when ifnull(t1.m1,'*') != ifnull(t2.m1,'%') then -100 when ifnull(t1.m1,'*') = ifnull(t2.m1,'%') then 1 else 0 end) +
(case when ifnull(t1.m2,'*') != ifnull(t2.m2,'%') then -100 when ifnull(t1.m2,'*') = ifnull(t2.m2,'%') then 1 else 0 end) +
(case when ifnull(t1.m3,'*') != ifnull(t2.m3,'%') then -100 when ifnull(t1.m3,'*') = ifnull(t2.m3,'%') then 1 else 0 end) +
(case when ifnull(t1.m4,'*') != ifnull(t2.m4,'%') then -100 when ifnull(t1.m4,'*') = ifnull(t2.m4,'%') then 1 else 0 end) +
(case when ifnull(t1.m5,'*') != ifnull(t2.m5,'%') then -100 when ifnull(t1.m5,'*') = ifnull(t2.m5,'%') then 1 else 0 end) +
(case when ifnull(t1.m6,'*') != ifnull(t2.m6,'%') then -100 when ifnull(t1.m6,'*') = ifnull(t2.m6,'%') then 1 else 0 end) +
(case when ifnull(t1.m7,'*') != ifnull(t2.m7,'%') then -100 when ifnull(t1.m7,'*') = ifnull(t2.m7,'%') then 1 else 0 end) +
(case when ifnull(t1.m8,'*') != ifnull(t2.m8,'%') then -100 when ifnull(t1.m8,'*') = ifnull(t2.m8,'%') then 1 else 0 end) as match_rate
, t1.m1
, t1.m2
, t1.m3
, t1.m4
, t1.m5
, t1.m6
, t1.m7
, t1.m8
from t1 join t2
--order by 1,3 desc;
) t
de e kőré még kell valami ilyesmi:select t1.*, tt.kategoria
from t1
left join
(
-- ide jon az elozo query
) tt on t1.id = tt.id and tt.rnum = 1 and tt.match_rate != -800
De ez még nem tökéletes. Van benne néhány fal pozitív kategória.Azért szedtem ketté, mert azzal a belső queryvel még kell játszani és finomhangolni a match_rate-et
Jah és remélem nem olyan sok rekord van egyik táblában sem, mert azért a descartes szorzat befigyel rendesen.
Új hozzászólás Aktív témák
- iPhone 16 Pro Max / 512GB / White Titanium
- HP Z2 Mini G9 - i714700 /32gb/512gb/nVidia T1000 (GB
- ThinkPad P16s Gen1 16" FHD+ IPS i7-1260P T550 16GB 512GB magyarított (lézerezett) bill ujjlolv gar
- DELL 7060 Mini PC - Core i5 8500T 16GB vagy 32GB ram - 256/512GB SSD - csak pár db
- Apple iPad 10th 64GB, WI-FI, 1 Év Garanciával
- Dell Latitude 5580,15.6",FHD,i5-6300U,8GB DDR4,256GB SSD,WIN11
- Acer Chromebase All-in-One PC 23.8" Touchscreen
- HIBÁTLAN iPhone 15 Plus 256GB-1 ÉV GARANCIA - Kártyafüggetlen, MS4529
- HIBÁTLAN iPhone 13 Mini 256GB Green -1 ÉV GARANCIA - Kártyafüggetlen, MS4673
- BESZÁMÍTÁS! Philips 223V5LHSB2/00 22 75Hz FHD TN 5ms monitor garanciával hibátlan működéssel
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest

