Question: I have tried this query

```
 SELECT *
 FROM `references`
 WHERE
 (`continent_id` IN (2,8) AND `country_id`IN (18) )
   OR `continent_id` IN (2,8)
 LIMIT 0 , 30

```

here what I am trying to do is select those records with either both **country & continent id** or only **continent id** but above query always resulting the records with **continent id** only i.e ( OR `continent_id` IN (2,8) being always **true**)

Any idea what is going wrong in this query?

Thanks in advance!

Answer: 
Yes, you need to `wait` on the child processes. The reason is that otherwise there will still be data associated with the now zombie process, for example space for the process return value.
Have a look at using the daemon() command to place your app in the background, then use pthreads to manage the parallelism.

> 
> **NAME**
>  daemon - run in the background
> 
> 
> **SYNOPSIS**
>  #include 
> 
> 
> 
> ```
>    int daemon(int nochdir, int noclose);
> 
> ```
> 
> Feature Test Macro Requirements for glibc (see
>  feature\_test\_macros(7)):
> 
> 
> 
> ```
>    daemon(): _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
> 
> ```
> 
> **DESCRIPTION**
>  The daemon() function is for programs wishing to detach themselves from the controlling terminal and run in the background as
>  system daemons.
> 
> 
> 
> ```
>    If nochdir is zero, daemon() changes the process’s current working directory to the root directory ("/"); otherwise,
> 
>    If noclose is zero, daemon() redirects standard input, standard output and standard error to /dev/null; otherwise, no changes are made
> 
> ```
> 
> to these file descriptors.
> 
> 
>