Re: SQL Query Question
Date: 11 May 2001 16:19:43 +0300
Message-ID: <wed79gqaz4.fsf_at_siwenna.cs.uta.fi>
>>>>> "who" == who <Charcoal> writes:
who> Hi people, Assume I have a table which is just a list of numbers (only who> 1 column). I want to perform a query which shows every number under 100 who> which is NOT in the table. How do I do this?
who> For example, in my MyTable there is the following data: 1, 4, 7, 32, 54 who> (there are 5 records in my table).
who> Now how would I write a query to show all the numbers < 100 that are who> not in this table? ie, it should show 2, 3, 5, 8, .... etc.
Create another table, that has numbers from 1 to 100. Then make a select like
SELECT column
FROM table
DIFFERENCE
SELECT column
(or using NOT IN, if you prefer).
That is, SQL and relational model knows nothing about number theory.
FROM onetohundred
--
Arto V. Viitanen av_at_cs.uta.fi
University of Tampere, Department of Computer and Information Sciences
Tampere, Finland http://www.cs.uta.fi/~av/
Received on Fri May 11 2001 - 15:19:43 CEST