Skip site navigation (1) Skip section navigation (2)

Pls Hlp: SQL Problem

From: Hengky Lie <hengkyliwandouw(at)gmail(dot)com>
To: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Pls Hlp: SQL Problem
Date: 2008-09-12 09:22:51
Message-ID: 48CA34EB.90403@gmail.com (view raw or flat)
Thread:
Lists: pgsql-sql
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Dear friends,<br>
<br>
I have problem in postgresql&nbsp; view.&nbsp; This is the view (Pay attention to
the red and blue colours):<br>
<br>
SELECT tblpenjualan.tanggal, tblpenjualan."operator",
tblpenjualan.noinvoice, tblpenjualan.bayar, tblpenjualan.bayarvocher,
tblpenjualan.jam, tblpenjualan.id, tblpenjualan.jeniscard,
tbltransaksi.kodeproduk, tbltransaksi.keluar, tbltransaksi.harga,
tbltransaksi.disc1, tblproduk.namabarang, tblproduk.subkat,
tblsubkategori.subkategori, tblkategoriproduk.kode,
tblkategoriproduk.kategori, tbltransaksi.hargapokok *
tbltransaksi.keluar AS modal, <font color="#ff0000"><b>tbltransaksi.keluar
* tbltransaksi.harga - tbltransaksi.disc1 / 100::numeric *
(tbltransaksi.keluar * tbltransaksi.harga) AS jumlah</b></font>, <font
 color="#333399"><b>tbltransaksi.keluar * tbltransaksi.harga -
tbltransaksi.disc1 / 100::numeric * (tbltransaksi.keluar *
tbltransaksi.harga) - tbltransaksi.hargapokok * tbltransaksi.keluar AS
profit</b></font><br>
&nbsp;&nbsp; FROM tblpenjualan<br>
&nbsp;&nbsp; JOIN tbltransaksi ON tblpenjualan.id = tbltransaksi.jualid<br>
&nbsp;&nbsp; LEFT JOIN tblproduk ON tbltransaksi.kodeproduk::text =
tblproduk.kode::text<br>
&nbsp;&nbsp; LEFT JOIN tblsubkategori ON tblproduk.subkat::text =
tblsubkategori.id::text<br>
&nbsp;&nbsp; LEFT JOIN tblkategoriproduk ON tblsubkategori.kategoriid::text =
tblkategoriproduk.kode::text;<br>
<br>
The result is :<br>
<br>
<tt>"2008-07-20";"ULY";"01-200708";"Tunai";0.00;"1899-12-30
21:14:47+06:55:25";1;"";"8993417200021";1.00;4200.00;0.00;"ELIPS HAIR
VITAMIN ";"121";"VITAMIN RAMBUT";"NF";"Non Food";3960.0000;<b><font
 color="#ff0000">4200.000000000000000000000000</font></b>;<font
 color="#333399"><b>240.000000000000000000000000</b></font><br>
"2008-07-20";"ULY";"01-200708";"Tunai";0.00;"1899-12-30
21:14:47+06:55:25";1;"";"8991001111425";3.00;1650.00;0.00;"TAKE-IT MILK
CHOCOLATE WAFER 17 G";"8";"BISKUIT";"MKN";"Makanan";4680.0000;<font
 color="#ff0000"><b>4950.000000000000000000000000</b></font>;<b><font
 color="#333399">270.000000000000000000000000</font></b><br>
"2008-07-20";"ULY";"01-200708";"Tunai";0.00;"1899-12-30
21:14:47+06:55:25";1;"";"8991115000103";2.00;1600.00;0.00;"ALPENLIEBE
ORIGINAL 41 G ISI 10 BTR";"62";"PERMEN";"MKN";"Makanan";3000.0000;<font
 color="#ff0000"><b>3200.000000000000000000000000</b></font>;<b><font
 color="#333399">200.000000000000000000000000</font></b><br>
"2008-07-20";"ULY";"01-200708";"Tunai";0.00;"1899-12-30
21:14:47+06:55:25";1;"";"8990800010533";1.00;1600.00;0.00;"MENTOS CHEWY
DRAGEES 37 G";"62";"PERMEN";"MKN";"Makanan";1500.0000;<font
 color="#ff0000"><b>1600.000000000000000000000000</b></font>;<b><font
 color="#333399">100.000000000000000000000000</font></b></tt><br>
<br>
Why&nbsp; the calculation result has so many decimals ?<br>
<br>
Thank you<br>
<br>
</body>
</html>


Attachment: unknown_filename
Description: text/html (3.0 KB)

In response to

Responses

pgsql-sql by date

Next:From: Richard HuxtonDate: 2008-09-12 10:23:38
Subject: Re: Pls Hlp: SQL Problem
Previous:From: Peter EisentrautDate: 2008-09-12 07:24:51
Subject: Re: DIfference between max() and greatest() ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group