0

I want to run following query in Parse.com Objective-C library for iOS and wondering how to do it.

Select * From Table Where firstName = "" OR lastName = "";

How I can achieve this in Objective-C library?

0

1 Answer 1

3

You can do by using orQueryWithSubqueries as :

PFQuery *Query1 = [PFQuery queryWithClassName:@"yourClassName"];
[Query1 whereKey:@"firstName" equalTo:@""];

PFQuery *Query2 = [PFQuery queryWithClassName:@"yourClassName"];
[sQuery2 whereKey:@"lastName" equalTo:@""];

NSArray *arrQuery = [[NSArray alloc]initWithObjects:Query1,Query2, nil];
PFQuery *mainQuery = [PFQuery orQueryWithSubqueries:arrQuery];

[mainQuery findObjectsInBackgroundWithBlock:^(NSArray *arrRes,NSError *error) {

    if (!error) {
        NSLog(@"All data is = %@",arrRes);
    } else {
        DisplayAlertWithTitle(@"Error",@"Unable to get record");
    }
}];

I think this will work for you.let me know if you any other question on parse.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.