"Fabiano Sidler"
<[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> create view dbapp as
> select tablename,group_concat(tablefield) as fields from
> dbapp_tablenames as ts left join dbapp_tablefields as fs on
> (ts.tablenameID=fs.tablenameID)
> group by ts.tablenameID;
>
> create trigger dbapp_insert instead of insert on dbapp begin
> select raise(rollback, 'field already in table')
> where (
> select * from dbapp_tablefields
> where tablefield=new.fields and tablenameID=new.tablenameID
> ) is not null;

I'm not sure where you expect new.tablenameID to come from. Your view 
has only two columns, and you provide only two values in the INSERT, 
neither of which is tablenameID. Perhaps you want something like this:

select * from dbapp_tablenames t join dbapp_tablefields f
    on (t.tablenameID = f.tablenameID)
where tablefield=new.fields and tablename=new.tablename

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to