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?
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.