PCHomepage
Programmer
This may just take another pair of eyes to spot what I've missed. This query, which is trying to find some tenuous matches between tables is working but it is pulling up values that I am not selecting. Rather than just find matches with C4DA, it is also getting matches with C4GA. The query itself is built dynamically from a series of select boxes so there may be times when C4GA is also selected (ie.: kv.chipname IN ('C4DA','C4GA')) but it should not show unless it has been chosen! Can anyone spot what I've done wrong?
And then there is this query for the select box itself which is also working but it is extraordinarily slow, sometimes even timing out even before any selections have been made. It too is built dynamically with each succesive select box being limited by choices made and automatically submitted from the last. The red differ from select box to select box and are created dynamically:
Code:
SELECT u.FileName, u.ID, u.UploadDate, u.UpdateDate, u.EntryType FROM dcs_keysvals kv, dcs_uploads u
WHERE u.Segment1
IN (SELECT DISTINCT chipname FROM dcs_keysvals WHERE chipname IS NOT NULL AND kv.chipname IN ('C4DA') )
AND (u.Segment3 IN (SELECT DISTINCT lot FROM dcs_keysvals WHERE lot IS NOT NULL AND kv.chipname IN ('C4DA') )
OR u.Segment2
IN (SELECT DISTINCT lot FROM dcs_keysvals WHERE lot IS NOT NULL AND kv.chipname IN ('C4DA') ))
AND u.EntryType <> 'QE'
GROUP BY u.FileName
ORDER BY u.FileName
And then there is this query for the select box itself which is also working but it is extraordinarily slow, sometimes even timing out even before any selections have been made. It too is built dynamically with each succesive select box being limited by choices made and automatically submitted from the last. The red differ from select box to select box and are created dynamically:
Code:
SELECT kv.chipname
FROM dcs_keysvals kv
WHERE kv.chipname IN (SELECT DISTINCT Segment1 FROM dcs_uploads WHERE EntryType <> 'QE')
AND (kv.lot IN (SELECT DISTINCT Segment3 FROM dcs_uploads WHERE EntryType = 'Bench')
OR kv.lot IN (SELECT DISTINCT Segment2 FROM dcs_uploads WHERE EntryType = 'Probe'))
[COLOR=red]AND kv.chipname IN ('C4DA', 'C4GA')[/color]
GROUP BY kv.[COLOR=red]chipname[/color]
ORDER BY kv.[COLOR=red]chipname[/color]