Hi Steve, This is my problem: create table inet0 (dest, mask, nexthop); create index inet0_idx on inet0(mask, destination); insert into inet0 values(x'01000000', x'FF000000', x'08080808'); insert into inet0 values(x'01010000', x'FFFF0000', x'16161616'); insert into inet0 values(x'01010100', x'FFFFFF00', x'24242424'); insert into inet0 values(x'01010100', x'FFFFFF00', x'44444444');
select * from inet0 where destination=bitand(x'01010101', (select mask from inet0 where destination=bitand(x'01010101, mask) order by mask desc)) order by mask desc; The objective of the above select is to find one or more longest mask nexthop values. I want to make a view for the above select and pass in a destination variable as parameter. Thanks, -Alex On Tue, Jul 1, 2008 at 2:41 PM, Stephen Woodbridge <[EMAIL PROTECTED]> wrote: > Alex Katebi wrote: > > The problem with the view is that you can not pass a parameter or > variable > > from the outer select to the views select. > > Right that is not the purpose of a view. Think of a view as a virtual > TABLE. You can not pass a parameter to a table either. You can just > query the table or view and you CAN query with a parameter in the select > statement. > > select * from <table_or_view> where .... > > Maybe it would be help to restate what you are trying to do. > > -Steve > > > On Mon, Jun 30, 2008 at 12:49 AM, Igor Tandetnik <[EMAIL PROTECTED]> > > wrote: > > > >> "Henrik Bechmann" <[EMAIL PROTECTED]> > >> wrote in message news:[EMAIL PROTECTED] > >>> Thanks Igor! And the SQL statement can be bound to parameters in the > >>> usual ways? > >> No, not in the view. You can, of course, select from the view (as if it > >> were a table), and _that_ query can be parameterized. > >> > >> 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 > > _______________________________________________ > 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