How to Trunc one number and Round another number in different row?
Here is a sample where I take a percent of a number.
<code>
SELECT 40*.5 AONE, 'A' aname
FROM DUAL
UNION ALL
SELECT 121*.5 AONE, 'B' aname
FROM DUAL
UNION ALL
SELECT 121*.5 AONE, 'C' aname
FROM DUAL
UNION ALL
SELECT 80*.5 AONE, 'D' aname
FROM DUAL
</code>
this gives me
20 A
60.5 B
60.5 C
40 D
I want to TRUNC one number and ROUND another number where the number has a
"0.5" so I would have
20 A
61 B
60 C
40 D
I will have more than 4 records, just trying to keep it simple.
Suggestions?
TIA
Steve42
Edited by: Steve42 on Dec 5, 2011 1:44 PM
I missed you only want to truncate/round where value fractional part is .5:
WITH SAMPLE_TABLE AS (
SELECT 40*.5 AONE, 'A' aname FROM DUAL UNION ALL
SELECT 121*.5 AONE, 'B' aname FROM DUAL UNION ALL
SELECT 121*.5 AONE, 'C' aname FROM DUAL UNION ALL
SELECT 80*.5 AONE, 'D' aname FROM DUAL
SELECT CASE MOD(ABS(AONE),1)
WHEN .5 THEN
CASE MOD(ROW_NUMBER() OVER(ORDER BY CASE MOD(ABS(AONE),1) WHEN .5 THEN ANAME END NULLS LAST),2)
WHEN 1 THEN TRUNC(AONE)
WHEN 0 THEN ROUND(AONE)
END
ELSE AONE
END AONE,
ANAME
FROM SAMPLE_TABLE
ORDER BY ANAME,
ROW_NUMBER() OVER(ORDER BY CASE MOD(ABS(AONE),1) WHEN .5 THEN ANAME END NULLS LAST)
AONE A
20 A
60 B
61 C
40 D
SQL> SY.
Edited by: Solomon Yakobson on Dec 5, 2011 5:05 PM
Similar Messages
-
thx guys.....i have a progress now in LV
But now i have new trouble here. Ok i attached my LV file (LV 7.0.1/7.1) and excel form. I just could'nt calculate more than one input value. I want a different result for each value that i enter ... and store it into different rows and column. But it just store at one row.
Attachments:
My Project.vi 31 KB
rumus motor bakar.xls 14 KBduplicate post
-
how can I remove the Apple ID authorization only on one computer and authorize another in his place?
De-authorize the computer in question.
Then authorize the new computer.
Or de-authorize all computers and authorize only the ones that actually exist. -
I'm new to Mac book. Using Pages I have written 49 chapters of a novel. Can anyone tell me in simple terms how to put them into one document and have Pages number them? I am lost.
Hello, Lost! Yes you are a bit; try the Pages forum here; https://discussions.apple.com/community/iwork/pages
While I do use Pages, I don't know the answer to that one, but I'm sure you'll soon get help in the right forum. -
How to drop a schema and load another one?
I have an interruption during installing the central instance of a SAP Netweaver 04s System. After I restarted the installation I found this message in the Log file.
<b>ERROR 2006-08-16 16:17:04</b>
CJS-30109 The Java load in database PDV/liesc1ddbw01 has already been configured. <p> SOLUTION: Drop the schema and load it with a new load before running this installation.
<b>ERROR 2006-08-16 16:17:04</b>
CJS-30109 The Java load in database PDV/liesc1ddbw01 has already been configured. <p> SOLUTION: Drop the schema and load it with a new load before running this installation.
<b>ERROR 2006-08-16 16:17:04</b>
FCO-00011 The step getJavaLoadType with step key |NW_Java_CI|ind|ind|ind|ind|0|0|NW_CI_Instance|ind|ind|ind|ind|10|0|getJavaLoadType was executed with status ERROR.
QUESTION: How to drop a schema and load another one?Hello,
I got the similar error....but i did reinstall from o.s. and done the installation again...it was worked successfully..
if you find out alternate solution for that ...please let us know..
Regards, -
How to use one hash table inside another hash table
Hi everyone,
Any example of hash table inside another hash table.
Can one here help me how to write one hash table inside another with repeating keys for the first hash table.
Thanks,
kanty.Do you mean you want the 'value' entries in a hash table to themselves be hash tables? Easy but this often indicates a design flaw.
Hashtable<String,<Hashtable<String,Value>> fred = new Hashtable<String,<Hashtable<String,Value>> ();But what do you mean by "with repeating keys for the first hash table"?
Edited by: sabre150 on Jul 2, 2010 10:11 PM
Looks like you have already handled the declaration side in your other thread. I suspect you should be writing your own beans that hold the information and these beans would then be stored in a Map. The problem I have is that your description is too vague so I can't be certain. -
Insert one table and update another???
Hello,
I was wondering if it is possible to insert a record in one table and update another another record in a different table.
I have a form on my company's intranet that allows employees to add comments (ADDT Insert transaction) about new products we are going to bring to the market. At the same time, I would like to count the numbers of comments on a particular product and update that number for each product to see which product is getting the most reviews.
Right now the products are on the homepage with the title and inserted date. From there, the employees click on the product get the info and make comments about it. The problem for me is that I would like to see the comment counts for each product on the home page, which means I would have to update the product table with the count.
Sorry, I am using PHP as the technology.
When I used to do it in ASP, I would insert the comment using the POST from the form, but add another hidden field with the count in it and I would use the "Command" Server behavior to retrieve the number and update the other table field.
I noticed that dreamweaver removed the "Command" server behavior when using PHP.
All help is greatly appreciated
Charles.Hi Charles,
you can generally execute queries on a different table using Custom Triggers, and in regards to your "update the product table with the count" scenario the ADDT help file has a helpful pointer in the chapter "Custom transactions and triggers : Save additional information on login" -- in here you´ll find a sample "incremental counter" query which should be easy to adapt.
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
Is it possible to create an invoive that keeps a running total in one column and in another column keep total of monies spent from a starting amount of funding?
Hi Sara,
Many thanks for your reply. We just brought Adobe Acrobat XI Pro complete
with Adobe Forms Central, My manager asked whether I could use the forms
part to create a summary tracking sheet for all of our contracts.
Having looked at it I could see how to create a table that in the first
column deleted costs from a starting fund, and in the last keeps a running
total of all monies spent.
I agree, Excel does seem to be much better suited to the task. I was try
trying to comply with her request
Regards, -
How to find the font and replace another font using javascript in illustrator?
Dear All,
how to find the font and replace another font using javascript [batch process] in illustrator?
i have 700 image file, it very deficult replace one by one.
regards,
.Suresh.SAsk the creator of the file for a unprotected version.
-
How to map one modbus register to another modbus register in labview?
How to map one modbus register to another modbus register in labview? For example, let 40001 equal to 30001. Thank you.
StevenHello Steven,
Sorry, I was under the impression that you were using the complete Lookout development software (as opposed to just the Lookout Protocol Drivers). You cannot do any development (connections, mapping, etc.) with the Lookout Protocol Drivers (LPD). So, you were right. We have to do this in LabVIEW.
I ain't sure how exactly the Modicon floats work, but assuming what you're saying is correct, in your LabVIEW VI(s) you would read the DataSocket item corresponding to 40yyy+1 first, and then write this value back to the DataSocket item corresponding to 40xxx. Similarly, you would read the DataSocket item corresponding to 40yyy and then write the value read back to the DataSocket item corresponding to 40xxx+1.
A tip: I wou
ld at first make sure I have the OPC communication between LabVIEW and LPD working. Make sure you can read and write to the LPD registers via their DataSocket/OPC equivalents in LabVIEW. You can then implement the mapping as described above.
Hope this helps,
Khalid -
Verizon Deleted they tell you one thing and charge another
Verizon <Deleted> they tell you one thing and charge another data plans border on fraud
Message was edited by: Verizon ModeratorYou deserve a consistant experience gbe1951! Our Share Everything http://bit.ly/LWsodg plan is available equally to everyone... no hidden charges. If you'd like to talk about a specific charge on your bill, please follow and direct message me your mobile number and a little more detail about what's going on so I can help.
Thank you
JenniferH_VZW
Please follow us on Twitter @vzwsupport -
When I am syncing one albumn and then another the previous synced photos gets deleted why is it so?
That is how it works. Synced photos can't deleted directly on the iPad, instead that are deleted by not including them in the next photo sync - so you need to select and sync all the photos that you want to remain on the iPad on each photo sync
-
How do you add a mobile number and a home number to a contact on a 4S
How do you add a mobile number and a home number to a contact on an iPhone4S?
First add the mobile number. Once you've done that there should be another field that shows 'iPhone". Tap on 'iPhone' and change it to 'Home' then input the home number.
-
How can I delete an Apple ID from one device and replace it with a different ID on that same device?
Tthe brute force method: start with Settings > iCloud and turn off Find My (you will need the password), then change the iCloud ID, then go to the apps such as Messages, FaceTime, etc, and delete the Apple ID and enter the new one.
-
Numbering Group G1 can be used only for one CoCd and cash journal number
Hello,
I was trying to create a cash journal when I got the error message:
"Numbering Group G1 can be used only for one CoCd and cash journal number".
Does anyone have an idea what could be wrong?
Thank you,
BolaHi,
Please check whether more than one number range is maintained in transaction code FBCJC1. If yes, please keep only one as Cash Journal has only one number range. This is the internal number range for Cash Journal.
If you want different number range for accounting documents then create new document types and assign number ranges to it.
Regards,
Tejas
Maybe you are looking for
-
Error while Executing the Depreciation... in AFAB
Hi experts We have not at run the depreciation for 2008. If i run the depreciation in AFAB by selecting the following parameters Company code = ABCD Fiscal year = 2008 Posting Period = 001 Planned posting run Test run i m getting the following error.
-
I have tried everything I know of. It worked fine an hour ago. I have a white screen, buttons will not turn it off and I get get to anything. Any ideas whats going on? Thanks for any help.
-
Cannot download new firmware 1.0.2.0 for cannon s100
The site says the firmware cannot be found on the site????
-
701 How to backup saved pages of opera mini 6.5
Please tell me, where does saved pages will be present so that i can backup them. Thank you. -------------------If this post helped you, click on accept as solution.------------------ -----------------------------Appreciate by clicking on white star.
-
6.1 - BUG - ServletContext.getResourcePaths() returns paths with //
In 6.1 SP1, ServletContext.getResourcePaths(String path) returns paths which use the string "//" as one of the directory separators, instead of paths with only one "/". Example: application.getResourcePaths("/webapp/")would return a Set containing /w