ios - INNER JOIN Query is not working -


i using innerjoin query on 2 tables naming employee & department. there exists common empid(1234) common in both tables , want fetch data both tables using join query. not working. here code below:

nsstring *querysql = [nsstring stringwithformat: @"select employee.* employee   inner join  department on  employee.empid = department.empid =%@",_txtfind.text];          nslog(@"fetch query is%@",querysql);          const char *query_stmt = [querysql utf8string];          if (sqlite3_prepare_v2(database,         query_stmt, -1, &statement, null) == sqlite_ok)         {              if(sqlite3_step(statement) == sqlite_row)             {                 nsstring *name = [[nsstring alloc] initwithutf8string:                (const char *) sqlite3_column_text(statement, 0)];                 [resultarray addobject:name];                 nsstring *department = [[nsstring alloc]   initwithutf8string:(const char *) sqlite3_column_text(statement, 1)];                 [resultarray addobject:department];                 nsstring *year = [[nsstring alloc]initwithutf8string:                 (const char *) sqlite3_column_text(statement, 2)];                 [resultarray addobject:year];                 nslog(@"result array %@",resultarray);               }            else{                nslog(@"not found");                     }             sqlite3_reset(statement);         } 

its going else part , displays "not found". doing wrong? join query right? new join concept please me , ideas totally welcome.

this query, understand until end of on clause:

select employee.* employee inner join       department      on employee.empid = department.empid =%@",_txtfind.text]; 

perhaps want where clause of sort?

select e.*, d.col1, d.col2, . . . employee e inner join       department d      on e.empid = d.empid e.empid = 'txtfind.text';  -- 

in case, if doesn't help, edit question , show sql query after variable substitution.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -