I have a couple of SQL queries, both of which involve searching for misses rather than
searching for
hits. Would anybody be kind enough take a little time to assist me?
Suppose I have a table of products, a table of components, and a table which says
which components
are used in which products. How do I search for obsolete components - i.e. all
components which do
NOT appear in any products?
In another table, a subset of rows are to be given a quick reference tag, a maximum 4
digits, with
which users can mark "important" entries. The tag must obviously be unique. When the
user requests
that a row be tagged with a given number, I wish to find the nearest unused tag to
that which the
user supplies. Is there any way of getting SQL to do this for me, or should I just do
a SELECT tag
WHERE tag NOT NULL ORDER BY tag, then search the results for a gap near my desired
tag? Probably
less than 1000 tags will actually be used, so 1000 16-bit values is not much to
shuffle about and
binary chop - but as a lazy man I believe in getting existing software to do the job
if I can.
Thanks in advance for any assistance.
Alec
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php