Corrected it. Thank you. insert into t1( hh, t1info) values ((select h from t0 where t0info = ?), ?)
On Thu, Jan 12, 2012 at 11:35 AM, Durga D <durga.d...@gmail.com> wrote: > Dear Igor, > > Insertion time, I am able to get the rowid from > sqlite3_last_insert_rowid(); > > It's working fine. > > Now, t0info record already exists, that time , I should not update > with latest rowid. I should fetch the corresponding h value, update in t1 > table. Here, fetching is the problem: > > I tried with below code: not getting succ. > > sqlite3_stmt* stmtt1_hhfrom_t0; > > nres = sqlite3_prepare( dbconn, "insert into t1 values (?, ?, ?) > where hh = (select h from t0 where t0info = ?)" , -1, &stmtt1_hhfrom_t0, 0); > > if ( nres != SQLITE_OK ) return 0; > > Thanks in advance, > Durga. > > > On Thu, Jan 12, 2012 at 11:03 AM, Igor Tandetnik <itandet...@mvps.org>wrote: > >> Durga D <durga.d...@gmail.com> wrote: >> > Dear Igor, >> > >> > If already toinfo record exists, that time how to get the h >> > (primary key) (instead of rowid)? >> >> An INTEGER PRIMARY KEY column is in fact an alias for rowid. They are one >> and the same. >> -- >> Igor Tandetnik >> >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users