comparison - oracle query need to compare and get result in the same query -


I have a query that receives a record from a DB and puts it into another DB in the server using the script .

is like the query: -

  select from sourcedb.test id, date, iscomplete where id = '1' and date = '2011-03-15' and Iscomplete = 1;   

This query gives me some records, which I want only when there is a fixed number of records. For the East: - There are 10 records for '2011-03-15', then I want to complete all those 10 records, when there will be 1 full for all 10 records.

I should not work hard because in the near future the record can increase from 10 to 20.

Is there any way, I can modify my original question and check that if Icomplete = 1 is for everyone then get the record for that day and do not return anything .

I need to add one more condition to this query, if there are 10 records and half of them are completed i.e. full = 1 and half they are full & lt; & Gt; 1 In this case I do not want any output from the query and unless all records have all the = 1's.

Regards, Mansi

Just check next

 Select  id, date, iscomplete from sourcedb.test where id = '1' and date = '2011-03 -15' and do not exist (select 1 from sourcedb.test where id = '1' and date = '2011-03-15' and complete & lt;> 1);    

Comments