Hi RSmith,
Thanks. Still, I could not delete with single query.
create table if not exists emp(key integer not null, name text not null ,
personaldata text not null, unique(key, name));
insert into emp (key, name, personaldata) values(1, 'a', 'z');
insert into emp (key, name, personaldata) values(1, 'b', 'zz');
insert into emp (key, name, personaldata) values(2, 'c', 'y');
insert into emp (key, name, personaldata) values(3, 'd', 'yy');
insert into emp (key, name, personaldata) values(1, 'e', 'yyy');
bool delete_emp(int key, string name = "")
{
string query = ???;
if(name.length() > 0)
{
//needs to delete specific row. by unique key.
}
else
{
//needs to delete rows belongs to key
}
}
On Mon, Nov 18, 2013 at 2:13 PM, d b <[email protected]> wrote:
> Hi Luis,
>
> Those are parameters.
>
> This is the query after replacing with ?1 and ?2.
>
> delete from emp where key = '123' and (case when name = 'abc' is null THEN
> 1 else name = 'abc' end);
>
> It covered "delete from emp where key = '123' and name = 'abc';" but not
> other query.
>
> I tried with "select (case when name = 'abc' is null THEN 1 else name =
> 'abc' end) from emp;" query. It's always going to else portion when 'abc'
> doesn't exist in table. Any suggestions?
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users