On Tue, Oct 08, 2002 at 11:47:46PM +0200, [EMAIL PROTECTED] wrote:
> yes I know it is not 10% less , I am just making it easy to understand ,
> > On Tue, Oct 08, 2002 at 12:38:25PM +0200, [EMAIL PROTECTED] wrote:
> > > Is there a method is changing all selling prices of goods to be sold
> > > starting from a certain date
> > > The government applied the third stage of sales tax in egypt ,
> > > and instead of selling the product for 110 tax inclusive , then we have
> to
> > > make all invoices starting from October as 100 price and 10 sales tax,
> > > so all our previous prices shold be changed by less 10%
> > > Omar

First, you bring up psql

psql -d nameofdatabase

If it IS 10% less, then you would do something like this:

BEGIN WORK;
UPDATE parts SET price = price - price * 0.10;
SELECT * FROM parts;
COMMIT WORK;

But I think you can generalize that and figure out the exact math to
do this. For example:

UPDATE parts SET price = price*(1.0/1.1)

The reason it is bracketed by BEGIN and COMMIT because until you type
in "COMMIT WORK", it won't actually write into the databse. The
SELECT allows you to inspect that the prices went the way you want it
to go before continuing. If you are not satisfied, you would do
something like ROLLBACK WORK; instead of COMMIT.




-Qaexl-

http://www.next-horizons.com/qaexl/


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
-------------------------------------------------------
(un)subscribe: http://lists.sourceforge.net/lists/listinfo/sql-ledger-users
Archive: http://www.mail-archive.com/[email protected]/

Reply via email to