I have a question because I'm really bad at SQL. I understand the basic functions, but when it gets a little more complicated, I'm completely lost.
here's what i have:
tables: tA, tB
columns: tA: refA tB: refB
basically refA and refB are the same thing (some form identifier like xxx-xxx-xxx), but refB may contain information (e.g. xxx-xxx-xxx_Zxxx or xxx-xxx-xxx Zxxx)
here is what i know how to do this:
querying for elements that are in the table but not in the other (when they are exactly the same)
select refA
from tA
where not exists (select *
from tB
where tB.refB = tA.refA
)
:
, refA, refB.
, , "" , , ,
- . :
SELECT refA
FROM tA
WHERE NOT EXISTS (SELECT *
FROM tB
WHERE tB.refB LIKE CONCAT(tA.refA,'%'))
... , .
- , , , , ?
!
:
left() - , ref , ( ).
id - , , .
edit 2: , (MON, 10 )
, ,
:/
tA:
B20-60-04-6A-1
B20-60-04-6A-11
B20-60-04-6A-12
B20-60-04-6A-13
tB:
B20-60-04-6A-11_XX
B20-60-04-6A-12_XX
B20-60-04-6A-13_XX
mid(), left() .. , "B20-60-04-6A-1" (14 )
14 , 3 , tB...
, ?
tA :
(X, XYZ: charaters. X: -)
Xxx---
Xxx---
Xxx----
Xxx-----
..
tB:
Xxx-xx-xx-xx-xx-XYZ-xx Z xxx_XX
Xxx-----XYZZxxx_XX
Xxx-xx-xx-xx-xx Z xxx_XX
XYZ 3 . XYZ, .
, , :
- -XYZ
- , no -XYZ , "" _"
, VBA, SQL... , , : D