Concatenation

Creating tables and queries
Post Reply
capemayal1
Posts: 90
Joined: Fri Dec 31, 2010 5:16 pm

Concatenation

Post by capemayal1 »

I have a table with the fields representing the number of pills given to a patient at different times of the day.

The calculation below calculates the number of pills given daily x the units with a separate column for the measure of the pill (70mg, 5mg, etc.

If a daily dose is 1 pill in the morning for 70mg/pill, then the total daily dose is 70mg. If 2 pills then 140mg, etc.

The calculation below works as expected.

( "morning" + "afternoon" + "evening" ) * to_number( "units" )

Now I want to add the measure (mg, mcg, tablet) to the calculation result.

Using the sql in the query ( "morning" + "afternoon" + "evening" ) * to_number( "units" )|| "measure" results in a number with many trailing zeros - 250.000000000000000

I need to remove the trailing zeros.

Thank you.
FJCC
Moderator
Posts: 9277
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: concatenation

Post by FJCC »

Perhaps this will help you: How to format SQL table result.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Post Reply