Question: Is it possible to create the temporary directories in cocoa application for saving the files temporarily.

As per the scenario I need to process some video files and those files firstly will be converted to thumbnails etc then whose files will be uploaded to server.

How this can be achieved?

Answer: 
```
select p.* from San_Proposta p 
where p.StatusProposta_Id = 1

union 

select p.* from San_Proposta p 
    left join San_Negocio n on n.Proposta_Id = p.Proposta_Id
where p.StatusProposta_Id = 2
    and n.ValidaCaptacao <> n.ValidaVenda

```
Obviously, you did your best on English translation to help get an answer for your question. I understand the elements of the query, but don't know why / what you are specifically trying to get or exclude. In addition, why all within one query. What I am offering is one query to get all the elements if they exist or not and have just added some "flag" columns which you can use or not to restrict later. 

In short, a LEFT JOIN from San\_Proposta to your San\_Negocio on the common ID basically removes the need of your flag column of 1 or 2 to identify if a record exists or not in the other. If it finds a match, great, no matter if a false flag setting is on file. From there, you can detect the IF() qualifier of same vs different status codes on your other columns.

```
select 
      SP.*,
      CASE WHEN SN.Proposta_ID IS NULL THEN "No" ELSE "Yes" END as FoundInSanNegocio       
   from 
      San_Proposta SP
         LEFT JOIN San_Negocio SN
            ON SP.Proposta_ID = SN.Proposta_ID
   WHERE
         SN.Proposta_ID IS NULL
      OR NOT SN.ValidaCaptacao = SN.ValidaVenda

```

The having clause will specifically EXCLUDE those that ARE found in San\_Negocio AND the codes are the same value.

Now, you can scan through all the records and have all the statuses at one by the "flag" columns.

Found or not (again, doesn't matter about your flag column. If it has the key, its found on the LEFT JOIN).

If it WAS NOT found, then the "HasSameValidaCode" column would be set to "n/a" (not applicable), otherwise, it will be set to "Same" or "Different".