Build the query to select date with status
Hi guys,.
Grateful if you can advise me on how to build the query on below scenario:
Table A
Date
11.44.39.000000000 12-OCT-14 AM ASIA/SINGAPORE
11.44.35.000000000 16-SEP-14 AM ASIA/SINGAPORE
11.44.42.000000000 22-SEP-14 AM ASIA/SINGAPORE
The result of the query:
Date Status
11.44.39.000000000 12-OCT-14 AM ASIA / SINGAPORE inactive
11.44.35.000000000 16-SEP-14 active AM ASIA/SINGAPORE
11.44.42.000000000 22-SEP-14 AM ASIA/SINGAPORE inactive
Basically, the logic, I wanted is
Active principles: today date or max (date) < sysdate
Otherwise will be inactive
And there is 1 active date in time.
Thanks in advance
Hello
2753165 wrote:
Hi guys,.
Grateful if you can advise me on how to build the query on below scenario:
Table A
Date
11.44.39.000000000 12-OCT-14 AM ASIA/SINGAPORE
11.44.35.000000000 16-SEP-14 AM ASIA/SINGAPORE
11.44.42.000000000 22-SEP-14 AM ASIA/SINGAPORE
The result of the query:
Date Status
11.44.39.000000000 12-OCT-14 AM ASIA / SINGAPORE inactive
11.44.35.000000000 16-SEP-14 active AM ASIA/SINGAPORE
11.44.42.000000000 22-SEP-14 AM ASIA/SINGAPORE inactive
Basically, the logic, I wanted is
Active principles: today date or max (date)<>
Otherwise will be inactive
And there is 1 active date in time.
Thanks in advance
Sorry, we don't know what you want.
Are you saying that 1 row (maximum) can be assigned status = 'Active' and if 2 or more lines are eligible, the last of them will be called 'Active'?
If so:
CASE
WHEN tmstmp<=>=>
OR ROW_NUMBER () OVER (PARTITION BY CASE
WHEN tmstmp<=>=>
THEN "could be."
ANOTHER 'No Way'
END
ORDER BY tmstmp DESC
) = 1
THEN "active."
ELSE 'inactive '.
END
If you would care to post CREATE TABLE and instructions INSERT for some samples, so I could test it.
DATE is not a very good name for a column, especially if the column is a TIMESTAMP, not a DATE. I called the TMSTMP instead of the DATE column.
Tags: Database
Similar Questions
-
procedure that will dynamically build the query data and table Medallion
Hi people,
I write a procedure that dynamically build the query data and insert in the table "dq_summary".
enforcement procedure with success and data not inserted into the table 'dq_summary '.
I have thin problem in code attached below
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------FOR rep IN cur_di_attr LOOP dbms_output.put_line ('d: '); BEGIN EXECUTE IMMEDIATE 'SELECT table_name FROM ' || sum_tab || ' WHERE id = ' || rep.attribute_id INTO rep_tab; dbms_output.put_line ('rep_tab: '||rep_tab); run_query := run_query || ' ' || rep_tab || ' WHERE ' || nvl(wh_cond, '1 = 1'); EXECUTE IMMEDIATE run_query INTO end_rslt; EXECUTE IMMEDIATE 'UPDATE dq_summary SET ' || prop || '_' || p_code || ' = ' || end_rslt || ' WHERE attribute_id = ' || rep.attribute_id; dbms_output.put_line ('e: '); dbms_output.put_line ('rep_tab: '||rep_tab); dbms_output.put_line ('end_rslt: '||end_rslt); dbms_output.put_line ('f: '); EXCEPTION WHEN no_data_found THEN rep_tab := ''; sum_tab := ''; END; END LOOP;
but in the procedure below must be run several times
Published by: BluShadow on February 7, 2012 12:04create or replace PROCEDURE DQ_REPORT_PROC AS prop di_proposition.pro_name%type; col_var VARCHAR2(100); p_code dq_parameter.para_code%type; sum_tab di_proposition.summary_table%type; run_query dq_parameter.run_query%type; wh_cond dq_parameter.where_cond%type; end_rslt VARCHAR2(20); rep_tab VARCHAR2(50); v_error_msg VARCHAR2(200); v_error_code VARCHAR2(200); v_object_name VARCHAR2(50) DEFAULT 'DQ_REPORT_PROC'; v_iss_no VARCHAR2(20) DEFAULT NULL; CURSOR cur_di_prop IS SELECT upper(replace(replace(pro_name, ' '),'-')) pro_name FROM di_proposition; CURSOR cur_di_para IS SELECT upper(para_code) para_code, run_query, where_cond FROM dq_parameter; CURSOR cur_di_attr IS SELECT attribute_id FROM dq_summary; BEGIN DELETE FROM dq_summary; INSERT INTO dq_summary (attribute_id, entity_name, attribute_name, data_champ) SELECT a.attribute_id, b.entity_name, a.attribute_name, a.data_champ FROM di_attribute_master a, di_entity_master b WHERE a.entity_id = b.entity_id; FOR c_prop IN cur_di_prop LOOP prop := c_prop.pro_name; BEGIN SELECT distinct SUBSTR(column_name, 1, INSTR(column_name, '_')-1), summary_table INTO col_var, sum_tab FROM user_tab_cols a, di_proposition b WHERE a.table_name = 'DQ_SUMMARY' AND upper(replace(replace(b.pro_name, ' '),'-')) = prop AND SUBSTR(a.column_name, 1, INSTR(a.column_name, '_')-1) = upper(replace(replace(b.pro_name, ' '),'-')) AND upper(b.status) = 'Y'; dbms_output.put_line ('col_var: '||col_var); dbms_output.put_line ('sum_tab: '||sum_tab); EXCEPTION WHEN no_data_found THEN col_var := ''; sum_tab := ''; END; dbms_output.put_line ('a: '); FOR para IN cur_di_para LOOP dbms_output.put_line ('b: '); p_code := para.para_code; run_query := para.run_query; wh_cond := para.where_cond; dbms_output.put_line ('c: '); FOR rep IN cur_di_attr LOOP dbms_output.put_line ('d: '); BEGIN EXECUTE IMMEDIATE 'SELECT table_name FROM ' || sum_tab || ' WHERE id = ' || rep.attribute_id INTO rep_tab; dbms_output.put_line ('rep_tab: '||rep_tab); run_query := run_query || ' ' || rep_tab || ' WHERE ' || nvl(wh_cond, '1 = 1'); EXECUTE IMMEDIATE run_query INTO end_rslt; EXECUTE IMMEDIATE 'UPDATE dq_summary SET ' || prop || '_' || p_code || ' = ' || end_rslt || ' WHERE attribute_id = ' || rep.attribute_id; dbms_output.put_line ('e: '); dbms_output.put_line ('rep_tab: '||rep_tab); dbms_output.put_line ('end_rslt: '||end_rslt); dbms_output.put_line ('f: '); EXCEPTION WHEN no_data_found THEN rep_tab := ''; sum_tab := ''; END; END LOOP; END LOOP; END LOOP; COMMIT; EXCEPTION WHEN OTHERS THEN v_error_msg := SQLERRM; v_error_code := SQLCODE; TRACKER_LOG_EXECEPTION(v_iss_no, v_object_name, CURRENT_TIMESTAMP, v_error_msg, v_error_code); COMMIT; END DQ_REPORT_PROC;
addition of {noformat}{noformat} tags. Please read {message:id=9360002} and learn to do this yourself in future.
903830 wrote:
I write a procedure that dynamically build the query data and insert in the table "dq_summary".
enforcement procedure with success and data not inserted into the table 'dq_summary '.I'm sorry. But there is no kind of say that way. The code is undesirable. The approach is wrong. This will not happen. This will cause the fragmentation of memory in the shared Pool. This will lead to another session being impossible to analyze the sliders because of the fragmented memory.
Not only that. The underlying data model is questionable.
All this seems a candidate perfect as an example of how NOT to design and code and use Oracle.
-
Build the DNG SDK on Mac with XCode 6.2
Hi all
I am trying to build the DNG_SDK Version 1.4 with XCode 6.2. I downloaded all the third party for the xmp and dng sdk libraries. After connecting with the current xmp sdk 201412 errors, I tried to compile DNG_SDK with XMP SDK Version CS6. The subproject XMP is in my DNG_SDK and is built successfully.
For the DNG SDK, I always get errors from the linker and I have no idea why (without worrying which architecture I select i386 or x 64):
LD/Users/sboegel/Downloads/dng_sdk_1_4/dng_sdk/targets/mac/release/dng_validate normal i386
CD/Users/sboegel/Downloads/dng_sdk_1_4/dng_sdk/projects/mac
export MACOSX_DEPLOYMENT_TARGET appears = 10.9
/Applications/XCode.app/Contents/developer/toolchains/XcodeDefault.xctoolchain/usr/bin/CL ang ++ - arch i386 - isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOS X10.9.sdk-L/users/sboegel/Downloads/dng_sdk_1_4/dng_sdk/objectives/mac/release - F/users/sboegel/Downloads/dng_sdk_1_4/dng_sdk/objectives/mac/release - list of files/Users/sboegel/Library/Developer/Xcode/DerivedData/dng_validate-fjjibtptniqsozaqnhhmkybxy udz/Build/Intermediates/dng_validate.build/Default/dng_validate\ release.build/Objects-normal/i386/dng_validate. LinkFileList - mmacosx-version-min = 10.9/Users/sboegel/Library/Developer/Xcode/DerivedData/dng_validate-fjjibtptniqsozaqnhhmkybxy udz/Build/Products/libXMPFilesStatic.a/Users/sboegel/Library/Developer/Xcode/DerivedData/dng_validate-fjjibtptniqsozaqnhhmkybxy carbon udz/Build/Products/libXMPCoreStatic.a-cadre-Xlinker dependency_info - Xlinker/Users/sboegel/Library/Developer/Xcode/DerivedData/dng_validate-fjjibtptniqsozaqnhhmkybxy udz/Build/Intermediates/dng_validate.build/Default/dng_validate\ release.build/Objects-normal/i386/dng_validate_dependency_info.dat o/Users/sboegel/Downloads/dng_sdk_1_4/dng_sdk/targets/mac/release/dng_validate
Undefined symbols for the i386 architecture:
"< Std::string > TXMPMeta: Initialize() ', referenced from:
XMPFiles::Initialize (unsigned int, const char *, const char *) in libXMPFilesStatic.a (XMPFiles.o)
"TXMPMeta < std::string >: SetProperty (const char *, const char *, const std::string &, unsigned int) ', referenced from:
P2_MetaHandler::SetAudioInfoFromLegacyXML (bool) in libXMPFilesStatic.a (P2_Handler.o)
P2_MetaHandler::SetVideoFrameInfoFromLegacyXML (XML_Node *, bool) in libXMPFilesStatic.a (P2_Handler.o)
MP3_MetaHandler::ProcessXMP() in libXMPFilesStatic.a (MP3_Handler.o)
ReadIDXFile (const std::string &, const std::string &, TXMPMeta < std::string > *, bool &, MD5_CTX *, bool) in libXMPFilesStatic.a (SonyHDV_Handler.o)
XDCAMEX_MetaHandler::ProcessXMP() in libXMPFilesStatic.a (XDCAMEX_Handler.o)
XDCAM_Support::GetLegacyMetadata (TXMPMeta < std::string > *, XML_Node *, const char *, bool, std::string &) in libXMPFilesStatic.a (XDCAM_Support.o)
RIFF::importProperties(RIFF_MetaHandler*) in libXMPFilesStatic.a (RIFF_Support.o)
...
"TXMPMeta < std::string >: SetProperty (const char *, const char *, const char *, unsigned int) ', referenced from:
ID3_Support::ID3v1Tag:read(XMP_IO*,_TXMPMeta<Std::String>*) in libXMPFilesStatic.a (ID3_Support.o)
P2_MetaHandler::SetXMPPropertyFromLegacyXML (bool, XML_Node *, char const *, char const *, char const *, bool) in libXMPFilesStatic.a (P2_Handler.o)
P2_MetaHandler::SetGPSPropertyFromLegacyXML (XML_Node *, bool, const char *, const char *) in libXMPFilesStatic.a (P2_Handler.o)
P2_MetaHandler::SetAltitudeFromLegacyXML (XML_Node *, bool) in libXMPFilesStatic.a (P2_Handler.o)
MP3_MetaHandler::ProcessXMP() in libXMPFilesStatic.a (MP3_Handler.o)
MPEG4_MetaHandler::ProcessXMP() in libXMPFilesStatic.a (MPEG4_Handler.o)
ReadIDXFile (const std::string &, const std::string &, TXMPMeta < std::string > *, bool &, MD5_CTX *, bool) in libXMPFilesStatic.a (SonyHDV_Handler.o)
...
"TXMPMeta < std::string >: DeleteProperty (const char *, const char *) ', referenced from:
P2_MetaHandler::SetRelationsFromLegacyXML (bool) in libXMPFilesStatic.a (P2_Handler.o)
P2_MetaHandler::SetDurationFromLegacyXML (bool) in libXMPFilesStatic.a (P2_Handler.o)
P2_MetaHandler::SetGPSPropertyFromLegacyXML (XML_Node *, bool, const char *, const char *) in libXMPFilesStatic.a (P2_Handler.o)
P2_MetaHandler::SetAltitudeFromLegacyXML (XML_Node *, bool) in libXMPFilesStatic.a (P2_Handler.o)
P2_MetaHandler::ProcessXMP() in libXMPFilesStatic.a (P2_Handler.o)
JPEG_MetaHandler::ProcessXMP() in libXMPFilesStatic.a (JPEG_Handler.o)
MPEG4_MetaHandler::ProcessXMP() in libXMPFilesStatic.a (MPEG4_Handler.o)
...
Any hint is appreciated. Thank you
I found a trick here (Xcode Compile Error Undefined symbols for architecture x86_64: "TXMPMeta < std::string >: Initialize () which lacks an include statement, but which is defined in the sdk dng (dng_xmp_sdk.cpp):")
#if qMacOS
#ifndef MAC_ENV
#define MAC_ENV 1
#endif
#endif
#if qWinOS
#ifndef WIN_ENV
#define WIN_ENV 1
#endif
#endif
#include < new >
#include < String >
#define std::string TXMP_STRING_TYPE
#define XMP_INCLUDE_XMPFILES qDNGXMPFiles
#define XMP_StaticBuild 1
#include "XMP.incl_cpp".
This cannot be the reason...
Hi I came across similar issues. Try changing the X operating system deployment target "OS X 10.8" in the deployment section parameters build for the dng_validate project.
-
Create the form for selecting data in multiple tables
Hello
I'm getting APEX for the first time and I just read 2 days dev Application Express guide
I tried to play and I can't create a report with the form that select data from several tables
What I want to achieve is a report we'll say 'USERS' makes MANAGER_ID ID, NAME, with a form that allows me to create, delete, change users
The problem is that, once the report with the form created, if I click on create (to create a user) it will ask me for id, name, and manager_id
I need a water drop down which allows me to select managers in the table manager instead of manually insert Director id
How do I do that?
Thank you!
HI Chris,
LOV will use this magic.
Search:
Kind regards
BEnjamin
-
Adobe *.pdf files can be opened in Internet Explorer, the default program can not be changed to acrobat reader in the properties or select 'Open with'. Cannot change the default program of Adobe in the file association list.
I have the latest version of Adobe (9.3.3).
Hello
Don't forget to log on as an ADMINISTRATOR
Use this utility to unassociate the. PDF and then re - associate with Adobe Acrobat Reader.
How Unassociate a Type of Extension file in Vista and a utility to help
http://www.Vistax64.com/tutorials/91920-unassociate-file-extention-type.htmlHow to set default Associations for a program under Vista
http://www.Vistax64.com/tutorials/83196-default-programs-program-default-associations.htmlHow to associate a file Extension with a program Type in Vistahttp://www.vistax64.com/tutorials/69758-default-programs.html
How to view and change an Extension of filename on Vista
http://www.Vistax64.com/tutorials/103171-file-name-extension.htmlRestore the Type Associations by default Vista file extensions
http://www.Vistax64.com/tutorials/233243-default-file-type-associations-restore.html
I hope this helps.Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.
-
Compare the current time and date with last modified?
Compare the current time and date with last modified?
What is the ideal way due to report at the last modified file with the date and time class? last modifed class in the file value is of type long.798642 wrote:
No no no no, currentTimeMillis() only gets you the time... I need to compare the Date and time.You should read the docs more closely. It gives you the current time in time, which includes the date.
-
Not able to change the password by using the query.
Select APPS.fnd_web_sec.change_password ('username', 'password') 'RES' double;
Can someone tell why and what privileges and subsidies have flexibility to the user non-apps while it can change the password using fnd_web_sec.change_password.
Concerningthe information above does not solve my problem, I get the message
Because you do not have permission on all objects that are referenced by the API (see below).
Select FND_WEB_SEC. CHANGE_PASSWORD ('MARSHAD', 'mohammad @123') "RES" of the double
*
ERROR on line 1:
ORA-00942: table or view does not exist
ORA-06512: at the 'APPS '. FND_CORE_LOG', line 25
ORA-06512: at the 'APPS '. FND_CORE_LOG', line 432
ORA-06512: at the 'APPS '. FND_PROFILE', line 110
ORA-06512: at the 'APPS '. FND_SSO_MANAGER", line 227
ORA-06512: at the 'APPS '. FND_WEB_SEC', line 1425
ORA-06512: at line 1...
can you please list me what are the grants and other Jules Destrooper I should give to a user so that he can change password.
I don't have the list of objects and you should get yourself by consulting the site code and eTRM API.
by changing the DDT in the user non-apps after the grant, will, it may be able to change the password.please tell this syntax is correct or not.
Select applications. FND_WEB_SEC. CHANGE_PASSWORD ('user', 'pwd') "RES" of the doubleWhat is the point of using 'FND_WEB_SEC. CHANGE_PASSWORD' and not FNDCPASS or FND_USER_PKG API?
Thank you
Hussein -
Help with the query to select only one record from the result set in double
Hello
Please help with the query. Version of Oracle database we use is 10g R2.
I have a vision that is duplicated IDS, but they are used across the different functions. See below examples of data. Please help me with a query to select only one record (based on ID regardless of the area) from the bottom of the result set of duplicate records. For what is the point of view is there unique records, given the combination of the fields ID, Org, DF, dry, Sub-Sec
ID Org DF Sec Sub-Sec (163) CQ CPDM CPDM HD (163) PC ENG ENG ENG (163) CQ ASIC ASIC IS 8888 TS TAC TAC TAC (163) TS HE HE SW 6789 CQ INFO INFO FOS 6789 PC SECSYS SECSYS INFO1 6789 TS SECSYS SECSYS INFO2 9009 PC BMS BMS BMS1 My result set must eliminate the duplicate identifiers regardless of whoever we choose of the result set. (I mean without distinction Org, DF, s, Sub-s). My expected result set should be.
ID DSB DF SEC Sub-Sec (163) CQ CPDM CPDM HD 8888 TS TAC TAC TAC 6789 CQ INFO INFO FOS 9009 PC BMS BMS BMS1 Thank you
Orton
Hello
This sounds like a job for ROW_NUMBER:
WITH got_r_num AS
(
SELECT id, DSB, df, s, sub_sec org
ROW_NUMBER () OVER (PARTITION BY ID.
ORDER BY org
) AS r_num
OF view_x
)
SELECT id, DSB, df, sub_sec s,
OF got_r_num
WHERE r_num = 1
;
He is a Top - N query example, where you choose the elements of N (N = 1 in this case) from the top of an ordered list.
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and INSERT, only relevant columns instructions) to your sample data and the results desired from these data. (I know that you said that you were a view selection. Just for this thread, pretending it is a picture and post simple CREATE TABLE and INSERT statements to simulate your point of view).
Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places. (I didn't quite understand the explanation above. I don't know why you want toID ORG DF DRY SUB_SEC
-- --- -- --- -------
1234 CQ DPRK DPRK HD
and is not
1234 IS CQ ASIC, ASIC
or
TS 1234 IT IT SW
or
1234 CQ ASIC ASIC HD
)
If you change the query at all, post your modified version.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).See the FAQ forum: https://forums.oracle.com/message/9362002
-
Select the query to select the month range based on the current date.
It's the database 10 g oracel.
I want to choose two months of data in the table. But these two months should be based on the current date.
For example.
If I run the select query on July 7, 2013, then the query must ignore the current month being July 2013 and last month, which is June 2013 and it shoud select only may 2013 and April 2013.
Can someone help me how to make this request.
SELECT *.
FROM my_table
WHERE my_date > = TRUNC (ADD_MONTHS (sysdate,-3), 'MY') - first day of the month 3 months ago
AND my_date< trunc(add_months(sysdate,-1),'mon')="" --="" first="" day="" of="" last="">
-
How to build the query SQL for indexes work based on data - dict.?
Hello
I want to build the index 'create' - statement to all indexes have worked-based on the data dictionary.
For example:
create indexes tab1.ind1
on tab1 (lower (col3), lower (col1), col2, col4)
Tablespace "index."
I know I'll find all needed information views all_indexes, all_ind_columns and all_ind_expressions. During the generation of the create statement for the index of the order of the indexed columns must be correct (the order of the indexed column can be achieved using the "position_colonne" column of seen all_ind_columns and all_ind_expressions). But what would be the best way to provide all the necessary information in the right order?
One way would be a PLSQL procedure that puts it all together - but is it possible to use a single SQL statement?
Any help will be appreciated.
Rgds
JHYou can try using DBMS_METADATA. GET_DDL:
SQL> show user; USER is "TEST" SQL> drop table t; Table dropped. SQL> create table t(x varchar2(10)); Table created. SQL> create index i on t(upper(x)); Index created. SQL> select dbms_metadata.get_ddl('INDEX','I','TEST') from dual; DBMS_METADATA.GET_DDL('INDEX','I','TEST') -------------------------------------------------------------------------------- CREATE INDEX "TEST"."I" ON "TEST"."T" (UPPER("X")) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS"
-
Query to display data with total
Hi team,
I have the whee requirement I need to display data with total and the total general.
Examples of data include:
with t as (select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/02/2014','mm/dd/yyyy') dt , 2456 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual union all select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('06/10/2014','mm/dd/yyyy') dt , 1000 sal, 30 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual union all select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'NonReg' Status ,to_Date ('06/10/2014','mm/dd/yyyy') dt , 20 sal, -5 days , 1 intrst ,1 intrs1 ,1 intrs2 from dual union all select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/02/2014','mm/dd/yyyy') dt , 1153 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual union all select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/16/2014','mm/dd/yyyy') dt , 1000 sal, 8 days , 40 intrst ,45 intrs1 ,50 intrs2 from dual ) select * from t
Need the output like below format
Chris FT 10 PF Reg 02/05/2014 2456 10 50 55 60
Chris FT 10 Reg 10/06/2014 1000 PF 30 50 55 60
Chris 10 FT PF NonReg 10/06/2014 20 - 5 1 1 1
5456 35 101 111 121 subtotal
John PT PF Reg 02/05/2014 1153 11 10 50 55 60
John PT Reg 16/05/2014 1000 PF 11 8 40 45 50
2153 18 90 100 110 subtotal
7609 total 53 191 211 231
Could you please give some thought to get the result as above.
Thank you!
something like this:
with t as (select "chris" nm, 10 no, "Pi" Emplmt, "PF" ProFund "Reg" Status, to_Date (May 2, 2014 "," mm/dd/yyyy") dt, 2456 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double)
Union of all the
Select "chris" nm, 10 no, "Pi" Emplmt, "PF" ProFund "Reg" Status, to_Date (June 10, 2014 "," mm/dd/yyyy") dt, intrst 50, intrs1 55, 1000 sal, 30 days, 60 intrs2 of the double
Union of all the
Select "chris" nm, 10 no, "Pi" Emplmt, ProFund "PF", "NonReg" State, to_Date (June 10, 2014 "," mm/dd/yyyy") dt, 20 sal,-5 days, 1 intrst, 1 intrs1, 1 intrs2 of the double
Union of all the
Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (May 2, 2014 "," mm/dd/yyyy") dt, 1153 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double
Union of all the
Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (16 may 2014 "," mm/dd/yyyy") dt, 1000 sal, 8 days, intrst 40, 45 intrs1, 50 intrs2 of the double
)
SELECT decode (REUNION (nm), 1, 'Total', decode (grouping (State), 1, "partial": nm, nm)) nm
, no, emplmt, profund, status, dt, sum (sal), sum (days), sum (intrst), sum (intrs1), sum (intrs2)
T
Rollup Group (nm, (no, emplmt, profund, status, dt));
HTH
-
Hello
I got the info from a table named X.
Col1 Col2 Col3 Col4
IT01 20 01 X
IT01 20 50 X
IT01 30 01 X
IT01 30 50 X
If the value of "X" all 4 combinations of Col2 and Col3, Col4 the result should be displayed as
Col1, Col4
IT01 X
If the actual values are as
Col1 Col2 Col3 Col4
IT01 20 01 X
IT01 20 50 X
IT01 30 01 X
30 50 IT01 Y
The result should be displayed as
Col1, Col4
IT01 Y
How will generate the query for this?
Thank you
Thomas Titus
Published by: Titus Thomas on April 20, 2010 14:48Try this:
with test_tab as (select 'ITO1' Col1, 20 Col2, 01 Col3, 'X' Col4 from dual union all select 'ITO1' Col1, 20 Col2, 50 Col3, 'X' Col4 from dual union all select 'ITO1' Col1, 30 Col2, 01 Col3, 'X' Col4 from dual union all select 'ITO1' Col1, 30 Col2, 50 Col3, 'X' Col4 from dual union all select 'ITO2' Col1, 20 Col2, 01 Col3, 'X' Col4 from dual union all select 'ITO2' Col1, 20 Col2, 50 Col3, 'X' Col4 from dual union all select 'ITO2' Col1, 30 Col2, 01 Col3, 'X' Col4 from dual union all select 'ITO2' Col1, 30 Col2, 50 Col3, 'Y' Col4 from dual) --- end of mimicking your data; use SQL below: select col1, max(col4) col4 from test_tab group by col1; COL1 COL4 ---- ---- ITO2 Y ITO1 X
-
Create the query by combining data from DBSS_Data_Model and HostModel
Hello
I am trying to create a dashboard with the host server list and instances of SQL Server running on the host.
And I am interested in creating a query by combining data model of data in SQL Server (DBSS_Data_Model) and the host (Hosts) data model, say: which connects DBSS_SQL_Server_Host and host.
I wonder if there is way to do it?
Thank you
Mark
Something like this function should work:
def physicalHost = nullqueryStatement = server.QueryService.createStatement("(Host where name = '$hostName')")result = server.QueryService.executeStatement(queryStatement)objs=result.getTopologyObjects() if (objs != null && objs.size() > 0) { physicalHost = objs.get(0)}return physicalHost
When the input parameter "hostName" is DBSS_SQL_Server_Host.physical_host_name
Kind regards
Brian Wheeldon
-
Hi all
IAM trying to extract data from a table that has 3 columns I need to select data, of the same c1, c2 values the c3 must be unique. If the value of c3 is different, so I need to reject these data.
For example:
Table
C1 c2 c3
123 21 July 12 4
123 21 July 12 4
125 23 July 12 6
126 24 July 12 7
126 24 July 12 7
126 24 July 12 7
126 24 July 12 10
126 27 July 12 13
126 27 July 12 13
127 25 July 12 12
127 25 July 12 12
127 25 July 12 12
Result:
C1 c2 c3
123 21 July 12 4
125 23 July 12 6
127 25 July 12 12
126 27 July 12 13
And the oracle 8i installation version.
Please help me to write a query that takes less time to retrieve the data...
Thanks in advance!
-KelHi, Kel,
Here's one way:
SELECT c1, c2 , MIN (c3) AS c3 -- see note FROM table_x GROUP BY c1, c2 HAVING COUNT (DISTINCT c3) = 1 ;
Note: because the selected groups will only have 1 value of separate c3, it does not matter if you display the MIN or MAX. they will always be the same.
This assumes that c3 is not NULL. If c3 can be NULL, then the solution is a bit more complicated, but only a little.
-
Hello world!
Is it possible to get the layer, layerset and layer with the status layerset. Because I met a big problem out of it.
I have a single PS document which is contain the collection of layer, layer with layer games collection. I need apply the function for each layer and layers and each layer games with of layerset.
I also tried a code, but its error getting. Please help me out of this code...
-yajiv
#target photoshop
app.bringToFront ();
level of $= 2;
var app.activeDocument = docRef;
Journal of the var ="";
var x = 0;
var n = number (docRef.layers.length) - 1;
for (i = 0; i < n; i ++) {}
var tm = String (docRef.layers [i]);
var isLayer = tm.lastIndexOf ("ArtLayer");
var isLayerSet = tm.lastIndexOf ("LayerSet");
{if(isLayer!=-1)}
Check_LayerStructure (DocRef.Layers [i], 'Layer');
}
{if(isLayerSet!=-1)}
Check_LayerStructure (DocRef.layerSets, "LayerSets");
x = x + 1;
}
}
function Check_LayerStructure (objLayer, objflag, x) {------}
{if(objflag=="Layer")}
LayetStructure (objLayer, objLayer.name, BlendMode.NORMAL, 100, 100, 0, true, 'Layer');
}
else {if(objflag=="LayerSets")
LayetStructure (objLayer [x] objLayer [x] .name, BlendMode.PASSTHROUGH, 100, 100, 1, true, 'together');
m = Number (objLayer [x] .layers. Length)
for (j = 0; j < m; j ++) {}
var tm = String (objLayer [x] .layers [j]);
var isLayer = tm.lastIndexOf ("ArtLayer");
var isLayerSet = tm.lastIndexOf ("LayerSet");
{if(isLayer!=-1)}
Check_LayerStructure (objLayer [x]. Layers [j], 'Layer');
}
{if(isLayerSet!=-1)}
Check_LayerStructure (objLayer [x] .layerSets, "LayerSets", x);
}
} / / Loop Layerset
} / / I loop For
} //Function loop
function LayetStructure(layerRef,L,bMode,Opt,fillOpt,S,layVisible,Lref) {}
{if(layerRef.BlendMode!=bMode)}
If (confirm (L + Lref + "belend mode was bad...!)) \n"+"do you want to change...? »)) {
layerRef.blendMode = bMode;
Journal = Journal + "-" + L + Lref + "belend mode has been changed...! \n\n ";
e = 1;
}
}
{if(layerRef.Opacity!=opt)}
If (confirm (L + Lref + ' opacity has been "+ Math.round (layerRef.opacity) +"%...! ")) \n"+"do you want to change...? »)) {
layerRef.opacity = Opt;
Journal = Journal + "-" + L + Lref + ' opacity was changed to 100...! \n\n ";
e = 1;
}
}
If (layerRef.fillOpacity! = fillOpt & & S == 0) {}
If (confirm (L + Lref + ' Fill has been "+ Math.round (layerRef.fillOpacity) +"%...! ")) \n"+"do you want to change...? »)) {
layerRef.fillOpacity = fillOpt;
Journal = Journal + "-" + L + Lref + ' fill has been changed to 100...! \n\n ";
e = 1;
}
}
{if(layerRef.visible!=layVisible)}
If (L + Lref + ' left eye...! ") \n"+"do you want to change...? ») {
layerRef.visible = layVisible;
Journal = Journal + "-" + L + Lref + ' eye was turn on...! \n\n ";
e = 1;
}
}
}
Code of responsible for the action would naturally faster, but if you should be more comfortable with the DOM code, it could be useful to you.
#target photoshop
var theLayers = collectLayers (app.activeDocument, []);
Alert (theLayers.join ("\n"));
function to collect all the layers.
function collectLayers (theParent, allLayers) {}
If (! allLayers) {var allLayers = new Array}
else {};
the number of var theParent.layers.length = - 1;
for (var m = number; m > = 0; m-) {}
var theLayer = theParent.layers [m];
apply the function of games of layers;
If (theLayer.typename == "ArtLayer") {}
allLayers.push ([theLayer, theLayer.blendMode, theLayer.opacity, theLayer.fillOpacity])
}
else {}
allLayers = (collectLayers (theLayer, allLayers))
This line includes layer groups;
allLayers.push ([theLayer, theLayer.blendMode, theLayer.opacity, theLayer.fillOpacity]);
}
};
return allLayers
};
Maybe you are looking for
-
Where can I see the updates of future versions of Firefox OS?
I would like to know what are the next versions of Firefox OS updates
-
Toshiba HDR5010 DTT recorder will not turn
I had a few problems with this camera crashing to which I can live with a quick restart and return to normal but now it turn on at all. I have the red light comes on but no image, and it seems to have frozen I can't move channels etc.. I contacted to
-
How can I transfer my bookmarks from IE to Foxfire
I have a long list of favorites on my Internet Explorer screen. How can I transfer this list intact on my Foxfire screen? I don't know which toolbar are my favorites, because it is not marked anything other than bookmarks. Could be Windows, Internet
-
Hello I recently bought a camcorder HD of Camileo P30. Its an excellent package, but unusually for a camera with an optical lens, it does not come with a lens cap. Does anyone have any ideas on a suitable 3rd party lens cap or even if Tosh do that mi
-
I would use my Airport extreme for WiFi signal booster in my office room. I use a Time capsule as a base station and I use a second Time capsule as an Extender. Now, I want to measure my extender... I can get them both to look at my base station.