I have a database which allows duplicates where the key is a string and the values are URLs. Here's the schema:
CREATE TABLE Tags (p_tags TEXT, p_urls LONGVARCHAR);
I would like to do a command like this in an efficient manner: SELECT p_urls FROM Tags WHERE p_tags ='foo' INTERSECT ALL SELECT p_urls FROM Tags WHERE p_tags = 'bar';
I am aware the INTERSECT ALL
is not supported in sqlite, so my best effort right now is to do it by just counting up how many times each URL shows up in each p_tag and taking the minimum of the two. The trouble is that this is very slow - too slow.
Thanks.