How to get the desired result
I have an accmaster say table where each record has detailts on an acct as actno, curr_bal, branch, acct_type I want something as below abranch_no - Sum (curr_bal) where acct_type like 1% ' as sb - sum (curr_bal) where acct_type like 2%'s fd of the Group table by branch in a single line as shown below
00001 550000 65000000
00002 75909000 2568229867
Please tell how to do the above operation.
Hello
This is called a Pivot , and here's a way to do it:
SELECT branch_no
, SUM (CASE WHEN acct_type LIKE '1%' THEN curr_bal END) AS total_1
, SUM (CASE WHEN acct_type LIKE '2%' THEN curr_bal END) AS total_2
FROM accmaster
GROUP BY branch_no
;
This will work in any version of Oracle, from 8.1, but starting in Oracle 11.1, you can also use the SELECT... Function PIVOT.
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
Explain, using specific examples, how you get these results from these data.
Always tell what version of Oracle you are using.
Furthermore, your table is called
accmaster (where, I guess, ACC means 'account') and it contains called columns
ACTNO ( Act means 'account') and
acct_type ( acct means 'account')
Do you really need 3 different ways to shorten "account"? How do you recall when you used a way and when you have used another or when you used an underscore after the abbreviation character, and when you do not have? Even if you never get confused by these things, someone trying to help you, and one that should keep your code in the future, will probably. Do not use consistent, such as namespace
acct_master
Acct_No and
acct_type
?
Tags: Database
Similar Questions
-
How to get the desired result when subsequent month is not available
WITH T1 AS (SELECT 'A' COL1, 'B' COL2, 'C' COL3, '01-Jan-2015' DT, 10 QTY FROM DUAL UNION SELECT 'A' COL1, 'B' COL2, 'C' COL3, '01-feb-2015' DT, 20 QTY FROM DUAL UNION SELECT 'A' COL1, 'B' COL2, 'C' COL3, '01-mar-2015' DT, 30 QTY FROM DUAL UNION SELECT 'A' COL1, 'B' COL2, 'C' COL3, '01-may-2015' DT, 40 QTY FROM DUAL UNION SELECT 'A1' COL1, 'B1' COL2, 'C1' COL3, '01-mar-2015' DT, 40 QTY FROM DUAL UNION SELECT 'A1' COL1, 'B1' COL2, 'C1' COL3, '01-may-2015' DT, 40 QTY FROM DUAL) SELECT * FROM t1
Current output:
COL1 COL2 COL3 DT QTY. A B C January 1, 2015 10 A B C February 1, 2015 20 A B C 01-mar-2015 30 A B C 01-may-2015 40 A1 B1 C1 01-mar-2015 40 A1 B1 C1 01-may-2015 40 Expected results
COL1 COL2 COL3 DT QTY. DT REQ_VAL A B C 01/01/2015 10 01/01/2015 20 A B C 01/02/2015 20 01/02/2015 30 A B C 01/03/2015 30 01/03/2015 0 A B C 01/05/2015 40 01/05/2015 0 A1 B1 C1 01/03/2015 40 01/03/2015 0 A1 B1 C1 01/05/2015 40 01/05/2015 0 Logic:
If we COL1, COL2, COL3 combination for A, B, C, we have the quantity for 1 January, 1 February, 1 March, 1 may, and we don't have quantity for April 1 and June 1. I need following QUANTITY value as another column. If I use the lead, I'll get the value from May 1st to March 1st, but I want to value 0 because it is after March either.
What I've tried so far:
SELECT * FROM (WITH T1 AS (SELECT 'A' COL1, 'B' COL2, 'C' COL3, '01-Jan-2015' DT, 10 QTY FROM DUAL UNION SELECT 'A' COL1, 'B' COL2, 'C' COL3, '01-feb-2015' DT, 20 QTY FROM DUAL UNION SELECT 'A' COL1, 'B' COL2, 'C' COL3, '01-mar-2015' DT, 30 QTY FROM DUAL UNION SELECT 'A' COL1, 'B' COL2, 'C' COL3, '01-may-2015' DT, 40 QTY FROM DUAL) SELECT COL1, COL2, COL3, TO_DATE (T1.DT) DT, NVL (QTY, 0) QTY, MONTHS.DT ALL_DATES, LEAD (NVL (QTY, 0), 1, 0) OVER (ORDER BY MONTHS.DT) REQ_VAL FROM T1, ( SELECT ADD_MONTHS (TO_DATE ('01-jun-2015'), LEVEL - 6) DT FROM DUAL CONNECT BY LEVEL <= 12) MONTHS WHERE MONTHS.DT = T1.DT(+)) WHERE DT ISNOTNULL;
My query works for a set of COL1, COL2, COL3, am looking how we can achieve multiple COL1, COL2, COL3 (or) otherwise better query writing.
Thanks for your suggestions in advance.
Thank you
Now, to understand your condition: your additional column must indicate the amount of the next month, or zero if it is not a record for the month. How about this?
WITH T1
AS (SELECT 'A' COL1,)
'B' COL2,
COL3 'C ',.
To_date('01-Jan-2015','dd-mon-yyyy') DT,
QTY 10
OF THE DOUBLE
UNION
SELECT 'A' COL1,
'B' COL2,
COL3 'C ',.
To_date('01-Feb-2015','dd-mon-yyyy') DT,
QTY. 20
OF THE DOUBLE
UNION
SELECT 'A' COL1,
'B' COL2,
COL3 'C ',.
To_date('01-Mar-2015','dd-mon-yyyy') DT,
QTY 30
OF THE DOUBLE
UNION
SELECT 'A' COL1,
'B' COL2,
COL3 'C ',.
To_date('01-May-2015','dd-mon-yyyy') DT,
QUANTITY 40
OF THE DOUBLE
UNION
SELECT 'A1' COL1,
COL2 "B1."
COL3 "C1"
To_date('01-Mar-2015','dd-mon-yyyy') DT,
QUANTITY 40
OF THE DOUBLE
UNION
SELECT 'A1' COL1,
COL2 "B1."
COL3 "C1"
To_date('01-May-2015','dd-mon-yyyy') DT,
QUANTITY 40
THE DOUBLE)
X.Col1, x.col2, x.col3, x.dt, x.qty, NVL(y.qty,0) SELECT req_val
THE t1 x
LEFT OUTER JOIN t1 y
ON y.col1 = x.col1
AND y.col2 = x.col2
AND y.col3 = x.col3
AND y.dt = add_months(x.dt,1)
ORDER BY 1,2,3,4
My query works for a DFU, am looking how we can achieve multiple UTD
What is a DFU?
-
How to get the desired result of the post
Hi all.
I use APEX 4.0.
Now, I have two pages: A, B.
Transfer the student_id from page A to page B.
There is an article questioned B: student_name page select the CT where student_id =: student_id;
At the same time, I want to get the name of the student with the title of the region, I handle it like this: student name: & Student_Name. (with the '.') ;
If the bases of the student_name on column DB, the title work. After I have change student_name based on the query, it does not work.
How can I solve it. Thank you.Hi Andy,.
It depends on If the value is defined in this field. If you set the source of the element, it is probably too late for value must be used in the title of the region.
In general, I find that it is better to create a calculation that is running "Before Header" to set values in the page that I need to use when the page is loaded.
Andy
-
How to get the desired TableCell element of TableView?
Hello
I implement an editable table view.
I put the cell factory to generate editable cells in each column. Double click on any cell, the 'startEdit()' of my Tablecell method is called and a textfield appears.
My current role is on the text box TAB, the next cell in the column of the row must be in editable form. (that is to say I have to call the method startEdit() of the next collection of the TableCell element).
But I don't get how to get the element of the next column TableCell object.
Can someone help me get this behavior. ? If there is also another way to get this feature please let me know. ?
Here is the code I am trying to get with on the text field.
Thanks in advance.textField.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (t.getCode() == KeyCode.TAB){ System.out.println("Focus on next column...."); //getTableRow().getAlignment(); //getIndex(); //getTableView().getItems().get(getTableRow().getIndex()); //TableCell cell = (TableCell)getTableRow().getChildrenUnmodifiable().get(1); } } });
SAIMaybe, I'm not entirely understand your question, but could you not call tableView.edit (line, column) of your article and have this as the StartEdit method call for you?
-Jonathan
-
Failed to get the desired result
Hi gurus
Don't know why I get the following output:
Query
SOME jobs,
COUNT (*),
COUNT (CASE job WHEN 'CLERK' THEN 1 ELSE 0 END) cnt
WCP
Working GROUP;
The query result
WORK, COUNT (*), CNT
3 3 CLERKS
4 4 SELLER
THE PRESIDENT 1 1
MANAGER 3 3
1 1 ANALYST
According to my understanding, the result should be as below:
Result must be
WORK, COUNT (*), CNT
3 3 CLERKS
SELLER 4 0
THE PRESIDENT 1 0
MANAGER 3 0
ANALYST 1 0
Thanks in advance.
Concerning
Shu
Hello
Shuumail wrote:
Hi gurus
Don't know why I get the following output:
Query
SOME jobs,
COUNT (*),
COUNT (CASE job WHEN 'CLERK' THEN 1 ELSE 0 END) cnt
WCP
Working GROUP;
The query result
WORK, COUNT (*), CNT
3 3 CLERKS
4 4 SELLER
THE PRESIDENT 1 1
MANAGER 3 3
1 1 ANALYST
According to my understanding, the result should be as below:
Result must be
WORK, COUNT (*), CNT
3 3 CLERKS
SELLER 4 0
THE PRESIDENT 1 0
MANAGER 3 0
ANALYST 1 0
Thanks in advance.
Concerning
Shu
COUNT (*) tells you how many lines there are.
COUNT (exp) tells you how many lines have a value not NULL in exp
Your CASE expression never returns null; It always returns a value of 0 or 1, but never NULL. So, if exp is never NULL, so each line has a value not NULL and if COUNT (*) and COUNTY (exp) are always the same.
-
How to get the overall result sequence into LabView?
Hello
Could someone can help with this little problem?
We have a batch (.bat) that launches a list given TestStand sequences, which works as expected.
However, we monitor the results of each sequence and display it to the operator.
Our idea is to get the result of the sequence in a VI, executed at the end of the sequence and add it to a queue, which will be extracted and displayed on a monitor of VI, executed separately.
The only problem we have left must be able to recover the overall result of the sequence. Any idea or suggestion?
Thank you
Raphael
Thanks for all your replies. We finally finished queues sequencefailed node sequence context property value.
I also discovered the TestStand database logging and began to use it in parallel.
Thanks again
-
How to get the positive result of the search text page number?
How can I access the results of search text of javascript page number... (using the batch sequence)
search.matchCase = false;
search.wordMatching = "MatchPhrase;
Search.Bookmarks = true;
Search.Query ("whatIMSearching", "ActiveDoc");
....
get page numbers,
then do something like the export of pages that have this text in their...
Use the javascript method getPageNthWord.
-
How to get the same result on different characterset?
Hello experts,
I use
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production PL/SQL Release 11.2.0.3.0 - Production "CORE 11.2.0.3.0 Production" TNS for 64-bit Windows: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production
Needing a result even on my example.
SELECT ASCII('ˆ') -- when characterset is -NLS_CHARACTERSET WE8MSWIN1252 FROM DUAL; --result 136
SELECT ASCII('ˆ') -- when characterset is -NLS_CHARACTERSET AL32UTF8 FROM DUAL; --result 52102 but need 136
I need same result.
Thanks for your time...
EDITED RESULT.
Ask2Learn
You test something that you call "encrypted" data, which are not at all encryption.
For example speaking of letter t.
The CHR (ASCII('t') + 20) operation is pretty useless. You try to find the character that has the code binary and longer than 20 that the letter 't'. This can work with single-byte as WE8MSWIN1252 character sets, but it does not work with variable width as AL32UTF8 character sets. The letter 't' a code 0 x 74 in WE8MSWIN1252 and AL32UTF8. If you add 20 (decimal), you get 0 x 88. Byte 0 x 88 is a valid code in the WE8MSWIN1252, but is not a valid code in AL32UTF8. Bytes in this range may bytes of continuation in AL32UTF8, i.e. a second, third or the fourth byte of a multi-byte sequence.
The "circumflex accent" character code 0 x 88 (in WE8MSWIN1252) has the code of two bytes 0xCB 0 x 86 in AL32UTF8.
So, why not take a look at DBMS_CRYPTO integrated
Hope this helps
Hamid
-
SQL query to get the desired result
I have the array with the following values
Account Functional currency Billing currency Amount Header 5 101 USD USD 10 h 00 101 USD CAD 12 h 00 102 JPY USD 9 h 00 102 JPY CAD 3.00 102 JPY SGD 2.00 If the account has one different inv_currencypar that the functional currency and then
I have to summarize the amount in this account by viewing the billing currency
If the account has more than one other inv_currencypar that the functional currency and then
I have to summarize the amount in this account showing the functional currency as the currency of invoicing
I need output like this:
Account
Functional currency Billing currency Total amount Header 5 101 USD CAD 10:00 pm 102 JPY JPY 2:00 pm Can we get over output in sql without writing pl/sql program?
Hello
According to your specific needs, here's a way:
SELECT account
functional_currency
CASE
WHEN 1 = COUNT (DISTINCT NULLIF (invoice_currency
functional_currency
)
)
THEN MAX (NULLIF (invoice_currency
functional_currency
)
)
Of OTHER functional_currency
END AS invoice_currency
The SUM of (amount) AS total_amount
header5
FROM table_x
GROUP BY account
functional_currency
header5
;
If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.
Is it possible to have 2 (or more) of different functional_currencies in the same account?
-
How to get the result of the query?
I'm looking to get output something like this...
If a profile exists on the Pb, I need Exists in the colum
PROFILE_A EXISTS
PROFILE_B DOES NOT EXIST
PROFILE_C EXISTS
Select distinct profile
decode (profile, "PASSWORD_PROFILE", "EXISTS", 'THERE is NO') 'STATUS '.
of dba_profiles;
How to get the above result? Anyone?
In the first query, you can add any profile you want to check, and then try the below
WITH qry1 AS (SELECT profile 'PROFILE_A' FROM dual
UNION ALL
SELECT "PROFILE_B" FROM double
UNION ALL
SELECT 'DEFAULT' double)
SELECT the profile
CASE WHEN EXISTS (SELECT 1 FROM dba_profiles dp
WHERE dp.profile = q1.profile)
THEN "EXISTS."
OTHERWISE "NOT EXIST".
The END as status
OF qry1 q1;
OUTPUT:-
-------------
SQL > WITH qry1 AS (SELECT profile 'PROFILE_A' FROM dual
2. ANY TRADE UNION
3. SELECT 'PROFILE_B' FROM dual
4 UNION ALL
5. SELECT 'DEFAULT' double)
6. SELECT profile,
7 CASE WHEN EXISTS (SELECT 1 FROM dba_profiles dp
8 WHERE dp.profile = q1.profile)
9 THEN 'EXISTS '.
10. OTHERWISE "NOT EXIST".
11 FINISSENT AS status
Qry1 q1 12;
PROFILE STATUS
--------- ----------
PROFILE_A DOES NOT EXIST
PROFILE_B DOES NOT EXIST
DEFAULT VALUE IS
-
How to get the previous record that meets a criterion?
Hello!
I am trying to create a query that adds information which finally fixed an element for a given 'pause'.
I have a table, let's call it actionHistory, which looks like:
ID | timestamp | action | author
------------------------------------------------
101477 | 2010-05-10 09:10:20 | Difficulty | Tim
101477 | 2010-05-10 09:10:30 | change | John
101477 | 2010-05-10 09:10:40 | breaking | Maggie
101477 | 2010-05-10 09:10:50 | Difficulty | Rick
222222 | 2010-05-10 09:10:30 | change | Lewis
222222 | 2010-05-11 09:10:40 | breaking | Maggie
222222 | 2010-05-11 09:10:50 | Difficulty | Tim
222222 | 2010-05-12 09:10:40 | Difficulty | Maggie
222222 | 2010-05-13 09:10:40 | breaking | Albert
I'm looking for is the following result:
ID | timestamp | action | author | lastFixBy
-----------------------------------------------------------
101477 | 2010-05-10 09:10:20 | Difficulty | Tim |
101477 | 2010-05-10 09:10:30 | change | John |
101477 | 2010-05-10 09:10:40 | breaking | Maggie | Tim
101477 | 2010-05-10 09:10:50 | Difficulty | Rick |
222222 | 2010-05-10 09:10:30 | change | Lewis |
222222 | 2010-05-11 09:10:40 | breaking | Maggie |
222222 | 2010-05-11 09:10:50 | Difficulty | Tim |
222222 | 2010-05-12 09:10:40 | Difficulty | Maggie |
222222 | 2010-05-13 09:10:40 | breaking | Albert | Maggie
Can you tell me how I can make?
I tried many ways but no return to what I'm looking for.
Thanks in advance.
Published by: user8910765 on June 5, 2010 13:51
Published by: user8910765 on June 5, 2010 14:00Hello
That's what you asked for in Oracle 10:
SELECT a.* , CASE WHEN action = 'break' THEN LAST_VALUE ( CASE WHEN action = 'fix' THEN author END IGNORE NULLS ) OVER ( PARTITION BY id ORDER BY tmstmp ) END AS lastfixby FROM actionhistory a ORDER BY id , tmstmp ;
Like all of the built-in functions, LAST_VALUE is documented in the manual of the SQL language:
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions073.htm#sthref1508user8910765 wrote:
... just in case where it might be useful, one of the queries I've tried myself a left subquery joined that Oracle has no right ("a column may be outside not attached to a subquery').Much more, it would help if you posted the request.
It looks like you were using the old outer join notation (+). You can get the desired results by using an outer join with ANSI rating, but I think it would be more complicated and slower than with a LAST_VALUE. -
How to get the last row and the sum of all columns in a query
Hello
is there a way to get the last record for a column and the sum of all the Archives to another column in the same query.
Best regards
You must set your needs correctly volunteers to help here...
Your data are not good enough to bring you a precise solution. Purpose, you do not have a column, which draws a distinction between the first and the last entry.
The solution becomes easy based on your design.
I introduced a grouping called 'id' column and a time column called 'time_of_insert' (only this way you can say with confidence that you can differentiate between the first and last (also a foolproof solution) - you can possibly use sequence (instead of date but if you say that you can insert two lines at the same time) ((and then likely sequence would be a better choice to differentiate instead of a timestamp field) etc...)
With your sample data, something like this can be done to get the desired results.
-----------------------------------------------------------------------------------------------------------------------
WITH dataset AS
(SELECT 1 id, 10 used, 8 remain, systimestamp + 1/24 time_of_insert FROM DUAL
UNION ALL
SELECT the 1 id, 1, 7, systimestamp + 2/24 FROM DUAL
UNION ALL
SELECT the id 1, 2, 5, systimestamp + 3/24 FROM DUAL
UNION ALL
SELECT 1 id, 1, 0, systimestamp + 4/24 FROM DUAL
UNION ALL
SELECT 1 id, 0, 0, systimestamp + 5/24 FROM DUAL
UNION ALL
SELECT the 1 id, 1, 4, systimestamp + 6/24 FROM DUAL)
SELECT *.
(SELECT SUM (used) ON sum_all)
FIRST_VALUE (stay)
COURSES (PARTITION BY id ORDER BY time_of_insert DESC)
last_row
Of THE dataset)
WHERE ROWNUM = 1;
Output:
------------------------
SUM_ALL LAST_ROW
------------------------------
15 4
See you soon,.
Manik.
-
How to get the week of the current month
Hi all
Is it possible to find the week of the current month.
Help, please...Hello...
Use this feature to get the desired result.
Hope it's okay...
CEILING (DAYOFMONTH ("Time D0". "T00 calendar date") (/ 7.00) "
Note: use 7.00 7 not only in the denominator*.
-
How to get the values based on the most recent date
Oracle Version 8i
How to get the new_value based on the most recent date
SELECT max (MODIFIED_ON), the Group LOG_ITEM_CHARACTERISTICS by MODIFIED_ON new_value - does not
Please, someone help me
CREATE TABLE LOG_ITEM_CHARACTERISTICS ( CHAR_LOG_ID NUMBER(10) NOT NULL, PIRM_ID VARCHAR2(8) NOT NULL, CONSTANT_FLAG VARCHAR2(1), CHARACTERISTIC_NAME VARCHAR2(25) NOT NULL, TYPE_NAME VARCHAR2(10) NOT NULL, NEW_VALUE VARCHAR2(3000), UOM VARCHAR2(10), MODIFIED_BY VARCHAR2(30), MODIFIED_ON DATE ) SET DEFINE OFF; Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (187376, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '1', 'AMPS', 'EMPXD88', TO_DATE('10/25/1999 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (187377, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMPXD88', TO_DATE('09/22/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (187378, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '0', 'AMPS', 'EMDXB88', TO_DATE('09/22/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (187384, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '2', 'AMPS', 'EMAXC29', TO_DATE('11/10/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (187385, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55.1', 'VOLTS', 'EMAXC29', TO_DATE('10/19/2001 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_ON) Values (2400742, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '2', 'AMPS', TO_DATE('10/19/2001 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (574093, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '2', 'AMPS', 'EMCTH88', TO_DATE('12/13/2002 11:55:16', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (574094, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMCTH88', TO_DATE('12/13/2002 11:55:16', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (3131486, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (3131487, '0307490N', 'N', 'LAST MEASURED DATE', 'PS2030/WVL', '16-12-04', 'DD/MM/YY', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (3131488, '0307490N', 'Y', 'POWER SUPPLY', 'PS2030/WVL', 'ESSENTIAL', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (3131489, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (4759086, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (4759087, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (4759088, '0307490N', 'N', 'LAST MEASURED DATE', 'PS2030/WVL', '14/11/07', 'DD/MM/YY', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6646012, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '5', 'AMPS', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646013, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646014, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6646015, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646016, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646057, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646058, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646059, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6648577, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6648578, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6648579, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6648580, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:36:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6648581, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:36:10', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6648634, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '5', 'AMPS', 'EMPXD88', TO_DATE('01/07/2011 13:51:06', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6648635, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'EMPXD88', TO_DATE('01/07/2011 13:51:06', 'MM/DD/YYYY HH24:MI:SS')); COMMIT;
user4587979 wrote:
Hi FrankYes, but I had more than 2 tables with item_characteristics, type_characteristics
If there are other tables involved, then CREATE TABLE and INSERT statements for them (for the relevant columns only). You must not post a lot of examples of data; usually just a couple of lines per table is enough to show the problem.
Also post the results desired from these data.What I try to do is, I'm comparing new_value in log_item_characteristics (whichever is most recent) with CHR_VALUE in the item_characteristics and the needs of different output values
I am trying to query is not giving desired out put
Point out some places where the output is wrong and explain how you get good results in these places, using specific examples from the data sample.
select lic.PIRM_ID, ic.CHR_ID, lic.CHARACTERISTIC_NAME, lic.TYPE_NAME, ic.CHR_VALUE, lic.NEW_VALUE, lic.MODIFIED_BY, lic.MODIFIED_ON, ic.CREATED_BY, ic.CREATED_ON,ic.MODIFIED_BY, ic.MODIFIED_ON from log_item_characteristics lic, item_characteristics ic,type_characteristics tc where lic.TYPE_NAME=tc.TYPE_NAME and lic.CHARACTERISTIC_NAME=tc.CHR_NAME and lic.PIRM_ID=ic.PIRM_ID and tc.CHR_ID=ic.CHR_ID and ic.CHR_VALUE <> lic.NEW_VALUE and lic.pirm_id in ('0307490N','0307521C') order by lic.pirm_id
Thank you; It is useful to see the existing query. Really, you have to format your code.
Please can you help me
What you've posted so far is like saying "I'm going 200 meters to the North, and then 500 meters East, but I'm not getting where I want to go." I would have a better chance to help you if you said, 'I'm out of my house, at 100, Elm Street and try to get to the supermarket at Broadway 279. I'm going 200 meters to the North... ', or, even better. "I want to buy a newspaper and some orange juice, so I thought I'd go to a convenience store. I start at my house, at 100, Elm Street... »
Always post some examples of data (CREATE TABLE and INSERT statements, as you did in your first post) and the desired results from these data. Explain how you get these results from these data. -
How to get the number of page i NTHE xml output
Hi all
Greetings!
Need help to display the page number in this format 1/1 and 1/2.
How to get this by setting a variable and do it randomly.
Help, please...
Thank you
Rajesh
Published by: David on March 26, 2010 12:20 AMIf you want to reset your page based on your provider number and then use for-each@section:your_supplier_grp
The page above format itself dial can be used to achieve the desired result.
Maybe you are looking for
-
Hi @all,My problem is the disk HARD is not visuable by Ghost or simular Backupsoftware, when I started the software via the external device, such as CDs or a stick.I tried several times with BartPE or the Symantec Ghost bootable CD, no succsess.The r
-
How do I reset the fan on Satellite Pro P100 control?
Hello My PSPAEE - 00E006EN Satellite Pro P100 turned on his car in his carrying case the other day.He got very, very hot. Now on the side fan runs all the time but otherwise his work as usual. An easy way to restore control of the fan? TKS.
-
nicaiu.dll errors causes matlab Crash
Hello Matlab 2010A using call nicaiu.dll and run the commands DAQmx. Most things work very well. However, very often (> 50% of the time) when I get home the DAQmx false or illegal settings (as I'm trying to develop and debug my code...) MATLAB will s
-
How to send a RESUME to a company?
I can save my RESUME but cannot send to a company
-
How to decompress cdrive?
Pop up asking ' do you want to compress all the files or Cdrive ', so I chose 'cdrive' and no PC will not work. It says that it cannot work in compressed files?