Subject Re: [firebird-support] hiding some records
Author Martijn Tonies
some records


> Hello, I use FB2.1. Is there any way to hide (at database level) some
records
> from a table. I have a quite simple scenario: selling articles marked as
> "inactive articles" And the use can choose wheter to see them or not. So
far in
> every query I have for the articles table I do *WHERE ACTIVE = 'Y'* The
problem
> is that in some forms I keep forgetting to add this clause and sometimes
the
> inactive articles appear even if they are "hidden" in my app. So I was
wandering
> if there is some way to filter that records in the database level.
Something
> like adding *WHERE ACTIVE = 'Y'* to every select I perform to the
article's
> table...

By far the easiest way of doing this is to create a view:

CREATE VIEW ACTIVE_ARTICLES AS
SELECT * FROM ARTICLES WHERE ACTIVE = 'Y'

and use that instead -unless- you want inactive articles as well.

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com