Concatenation

Creating tables and queries

Concatenation

Postby capemayal1 » Wed Jan 09, 2019 4:56 pm

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.
LO 4.0
JDBC DATABASE
HSQLDB 2.2.8
Ubuntu 12.10 64-bit
HP DV6 64-bit Laptop
capemayal1
 
Posts: 78
Joined: Fri Dec 31, 2010 5:16 pm

Re: concatenation

Postby FJCC » Wed Jan 09, 2019 5:44 pm

Perhaps this will help you: How to format SQL table result.
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7231
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA


Return to Tables & Queries

Who is online

Users browsing this forum: No registered users and 2 guests