Ask a Question related to MySQL, Design and Development.
- Mahesh BS #1
Query to find a missing number
I need to write a query to find out a set of missing number in a given
Eg : a Column in some table has the following data
Here I need to write a query to find out that number 7 is missing in the
One possible solution is by using any loop. But I am looking out if the same
can be achieved using any query.
Thanks in advance.
Mahesh BS Guest
- Our client installed Contribute CS3 using the correct serial number. They have misplaced the physical copy and are trying to figure out where to...
- Hi All, I am using CFPOP to retrieve mail from a server, then delete each message after I retrieve it. What I want to do is to check that I don;t...
- How can I find the row number for a specific record from one query in the record set of another query? qryGetCompany returns 6 records at a time. I...
- Hi, I am running apache on local pc/ under Windows. I need to figure out the ip number of the pc inside PHP. This is the number available when...
- Sorry, I know this is a basic question, but I can't seem to find the version number information for freehand. Normally I would guss it would be...
- Giuseppe Maxia #2
Re: Query to find a missing number
Mahesh BS wrote:> Hello,
> I need to write a query to find out a set of missing number in a given
> Eg : a Column in some table has the following data
> Here I need to write a query to find out that number 7 is missing in the
> given sequence.
> One possible solution is by using any loop. But I am looking out if the same
> can be achieved using any query.
in a large dataset, here's the method:
Create a table that contains a sequence, and use a LEFT JOIN to find the missing one.
To create a table and fill it with numbers quickly, use the method described in this article:
Then, you can issue a query like this:
LEFT JOIN sequence_table ON some_table.col_id = sequence_table.col_id
sequence_table.col_id IS NULL;
_ _ _ _
(_|| | |(_|>< The Data Charmer
Giuseppe Maxia Guest