Link to home
Start Free TrialLog in
Avatar of Stacie
StacieFlag for United States of America

asked on

String format Money

I have the following querry that give me the cost of medication as 63.9300 I would like to have this fomat instead. $69.93

SELECT     Prescription.ClientID, Prescription.CostMedication, Prescription.ReApplyDate, Prescription.[Med Rcvd Date], Prescription.Dosages,
                      Prescription.Frequency, Prescription.Notes, Medication_1.Medicaiton_Name, Prescription.MedicationID
FROM         Prescription INNER JOIN
                      Medication_1 ON Prescription.MedicationID = Medication_1.Medication_ID
WHERE     (Prescription.ReApplyDate BETWEEN @Date1 AND @Date2)
ORDER BY Prescription.ClientID
Avatar of kaufmed
kaufmed
Flag of United States of America image

Try:
SELECT     Prescription.ClientID, '$' + CONVERT(varchar(50), CONVERT(money, Prescription.CostMedication)), Prescription.ReApplyDate, Prescription.[Med Rcvd Date], Prescription.Dosages,
                      Prescription.Frequency, Prescription.Notes, Medication_1.Medicaiton_Name, Prescription.MedicationID
FROM         Prescription INNER JOIN
                      Medication_1 ON Prescription.MedicationID = Medication_1.Medication_ID
WHERE     (Prescription.ReApplyDate BETWEEN @Date1 AND @Date2)
ORDER BY Prescription.ClientID

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jason Yousef
Jason Yousef
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"63.9300 I would like to have this fomat instead. $69.93"

Format (varCurr, "$#.00")
Example select query:

SELECT a.f1, a.f2, Format([f3],"$#.00") AS Expr1
FROM a;
f1      f2      Expr1
1      2      $3.00
2      2      $4.00
2      3      $5.00