<p>I have 3 lists, I will make them simple here. </p>

<p>list of letters<br>
A<br>
B<br>
C  </p>

<p>list of numbers<br>
1<br>
2<br>
3                                               </p>

<p>Mixed<br>
A,1<br>
A,2<br>
B,2<br>
B,3<br>
C,1<br>
C,3</p>

<p>I need to know what is missing:<br>
A,3<br>
B,1<br>
C,2</p>

<p>The list of letters has about 85 entries<br>
and the list of numbers has about 500 entries.</p>

<p>The mixed list has about 75,000 entries.</p>

<p>I can use either a database query (mysql 5.0) or Turbo Delphi 2006 to process text files. What would be the best way to find what is missing?</p>

<p>Thanks,<br>
  Dave</p>

A cross join would produce every combination there is, given that you have both of your lists in SQL tables:
```
```
SELECT
  Letter + ',' + Number AS Combination
FROM
  NumberList,
  LetterList
```
```
Using the combined result (maybe save it into a temporary table), you can use a NOT EXISTS query to find what is missing:
```
```
SELECT
  Combination
FROM
  AllCombinations AS a
WHERE
  NOT EXISTS 
  (SELECT 1 FROM MyCombitations AS m WHERE m.Combination = a.Combination)
```
```
This would require a table
```
MyCombitations
```
, which lists all of the combinations you actually have and want to check against the full list.
If you want to speed things up, you should use a permanent table of combinations and an index on the
```
MyCombitations.Combination
```
field. For repeated querying this is definitely advisable.