select form mysql limit only 2 digit after decimal

`sellhead`.  VatAmt   some time it like   80.124 but I want 80.12   and some time it like 80.125  I want 80.13  How can I do that



SELECT `sellhead`.TrnDate, `sellhead`.InvoiceNo, `sellhead`.CName, `sellhead`.
       VatAmt, `sellhead`.NetAmt
  FROM AOL.sellhead `sellhead`
 WHERE (`sellhead`.InvoiceNo LIKE '00%') AND Month(TrnDate) = 1 AND Year(TrnDate)=2008

`sellhead`.        VatAmt
CREATE TABLE `sellhead` (
  `Branch` varchar(3) NOT NULL DEFAULT '0',
  `Code` double NOT NULL DEFAULT '0',
  `TrnDate` datetime DEFAULT NULL,
  `TType` char(1) NOT NULL DEFAULT 'A',
  `AccTp` ENUM('R','C','Q','D') NOT NULL DEFAULT 'R',
  `DocType` ENUM('I','D') NOT NULL DEFAULT 'D',
  `InvoiceNo` varchar(10) DEFAULT NULL,
  `DocNo` varchar(10) DEFAULT NULL,
  `InvoiceDate` datetime DEFAULT NULL,
  `BackNo` varchar(10) DEFAULT NULL,
  `Reference` varchar(15) DEFAULT NULL,
  `cid` double NOT NULL DEFAULT '0',
  `CName` varchar(100) DEFAULT NULL,
  `Adr1` varchar(40) DEFAULT NULL,
  `Adr2` varchar(40) DEFAULT NULL,
  `Address` text,
  `Zip` varchar(5) DEFAULT NULL,
  `DueDate` date NOT NULL DEFAULT '0000-00-00',
  `SCode` varchar(6) DEFAULT NULL,
  `Amount` double NOT NULL DEFAULT '0',
  `SpDiscount` double NOT NULL DEFAULT '0',
  `TotAmt` double NOT NULL DEFAULT '0',
  `TaxType` ENUM('E','I','N') NOT NULL DEFAULT 'E',
  `Vat` double NOT NULL DEFAULT '0',
  `VatAmt` double NOT NULL DEFAULT '0',
  `NetAmt` double NOT NULL DEFAULT '0',
  `RcvAmt` double DEFAULT NULL,
  `RealRcvAmt` double NOT NULL DEFAULT '0',
  `Remark` varchar(50) DEFAULT NULL,
  `BankCode` varchar(4) DEFAULT NULL,
  `ChqNo` varchar(15) DEFAULT NULL,
  `ChqDate` date DEFAULT NULL,
  `CreditCard` varchar(4) DEFAULT NULL,
  `CardNo` varchar(16) DEFAULT NULL,
  `CardExp` varchar(5) DEFAULT '  /',
  `Status` char(1) DEFAULT NULL,
  `ToAR` ENUM('Y','N') NOT NULL DEFAULT 'N',
  `UID` varchar(10) DEFAULT NULL,
  `UDT` datetime DEFAULT NULL,
  `PayDate` datetime DEFAULT NULL,
  `cancel_b` ENUM('Y','N') NOT NULL DEFAULT 'N',
  `canStaff` varchar(12) DEFAULT NULL,
  `canDate` datetime DEFAULT NULL,
  `CommCutOff` char(1) NOT NULL DEFAULT 'N',
  PRIMARY KEY  (`Code`),
  KEY `cancel_b` (`cancel_b`),
  KEY `UDT` (`UDT`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Transaction Header';

Open in new window

teeraAsked:
Who is Participating?
 
bobbit31Connect With a Mentor Commented:
ROUND(sellhead, 2)
0
 
Cornelia YoderConnect With a Mentor ArtistCommented:
SELECT `sellhead`.TrnDate, `sellhead`.InvoiceNo, `sellhead`.CName,  ROUND(`sellhead`.
       VatAmt,2), `sellhead`.NetAmt
  FROM AOL.sellhead `sellhead`
 WHERE (`sellhead`.InvoiceNo LIKE '00%') AND Month(TrnDate) = 1 AND Year(TrnDate)=2008
0
 
hieloConnect With a Mentor Commented:
See code below:
SELECT `sellhead`.TrnDate, `sellhead`.InvoiceNo, `sellhead`.CName, Format(`sellhead`.VatAmt,2)as VatAmount, `sellhead`.NetAmt
  FROM AOL.sellhead `sellhead`
 WHERE (`sellhead`.InvoiceNo LIKE '00%') AND Month(TrnDate) = 1 AND Year(TrnDate)=2008

Open in new window

0
 
teeraAuthor Commented:
when You round it  the remaining that you round will destroy or it keep

 

`sellhead`.NetAmt -  ROUND(`sellhead`. VatAmt,2)

if the value is   80.123  when round it become  80.12  ,   0.003  will destroy or it keep remaining ven you bring it to caluclate
0
 
hieloConnect With a Mentor Commented:
That will "loose" .003. YOu need:
ROUND( `sellhead`.NetAmt -  `sellhead`. VatAmt,2)
0
All Courses

From novice to tech pro — start learning today.