Pls Hlp: SQL Problem - Mailing list pgsql-sql

From Hengky Lie
Subject Pls Hlp: SQL Problem
Date
Msg-id 48CA34EB.90403@gmail.com
Whole thread Raw
In response to DIfference between max() and greatest() ?  ("Ruben Gouveia" <rubes7202@gmail.com>)
Responses Re: Pls Hlp: SQL Problem
List pgsql-sql
Dear friends,<br /><br /> I have problem in postgresql  view.  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.keluarAS 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 />    FROM tblpenjualan<br
/>   JOIN tbltransaksi ON tblpenjualan.id = tbltransaksi.jualid<br />    LEFT JOIN tblproduk ON
tbltransaksi.kodeproduk::text= tblproduk.kode::text<br />    LEFT JOIN tblsubkategori ON tblproduk.subkat::text =
tblsubkategori.id::text<br/>    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;"ELIPSHAIR VITAMIN ";"121";"VITAMIN RAMBUT";"NF";"Non
Food";3960.0000;<b><fontcolor="#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-ITMILK CHOCOLATE WAFER 17
G";"8";"BISKUIT";"MKN";"Makanan";4680.0000;<fontcolor="#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;"ALPENLIEBEORIGINAL 41 G ISI 10
BTR";"62";"PERMEN";"MKN";"Makanan";3000.0000;<fontcolor="#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;"MENTOSCHEWY DRAGEES 37
G";"62";"PERMEN";"MKN";"Makanan";1500.0000;<fontcolor="#ff0000"><b>1600.000000000000000000000000</b></font>;<b><font
color="#333399">100.000000000000000000000000</font></b></tt><br/><br /> Why  the calculation result has so many
decimals?<br /><br /> Thank you<br /><br /> 

pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: DIfference between max() and greatest() ?
Next
From: Richard Huxton
Date:
Subject: Re: Pls Hlp: SQL Problem