combination of queries:
bank_id, COUNT (*) select 1) CONFIGURED TERMINALINFO group by BANK_ID(2) select bank_id, COUNT (*) CONNECTED, SUM(CASE WHEN station_status = 'UP' THEN 1 ELSE 0 END) UP_STATUS, SUM(CASE WHEN station_status = 'DOWN' THEN 1 ELSE 0 END) DOWN_STATUS of terminalinfo where station_status in ('UP', 'DOWN')
and LAST_CONNECTED between January 31, 2012 00:00:00 ' and 31 January 2012 23:59:59 '
Bank_id group;
Can I combine the two queries and produce the result.
If you could provide examples of data that would allow the results to check, but I think that will do...
SELECT bank_id,
COUNT(*) configured,
COUNT(CASE
WHEN station_status IN ('UP', 'DOWN')
AND last_connected BETWEEN TO_DATE('31/01/2012 00:00:00','dd/mm/yyyy hh24:mi:ss')
AND TO_DATE('31/01/2012 23:59:59','dd/mm/yyyy hh24:mi:ss')
THEN
1
END
) connected,
SUM(CASE
WHEN station_status = 'UP'
AND last_connected BETWEEN TO_DATE('31/01/2012 00:00:00','dd/mm/yyyy hh24:mi:ss')
AND TO_DATE('31/01/2012 23:59:59','dd/mm/yyyy hh24:mi:ss')
THEN
1
END) up_status,
SUM(CASE
WHEN station_status = 'DOWN'
AND last_connected BETWEEN TO_DATE('31/01/2012 00:00:00','dd/mm/yyyy hh24:mi:ss')
AND TO_DATE('31/01/2012 23:59:59','dd/mm/yyyy hh24:mi:ss')
THEN
1
END) down_status
FROM
terminalinfo
GROUP BY bank_id;
HTH
David
Published by: Bravid on January 31, 2012 13:21
Tags: Database
Similar Questions
-
Combine 2 queries 1 result online results
OK so I have 2 requests from 2 different tables, and I'm combining them into a single request as follows:
Select * from
(select col1 from tblA where col1 = 'val1'),
(select col2 from tblB where col2 = 'val2') b
and the results back as (I expect only 1 result of each query):
col1, col2
=== ===
AA... 11
The problem is that when one of the subqueries returns no result, all of the query returns no results. I want a line of output, even if a query returns no results, as such:
col1, col2
=== ===
AA... NULL VALUE
OR
col1, col2
=== ===
NULL VALUE... 11
I looked at the different types of joins and unions, but have had trouble finding something simple that returns a single row - of the suggestions?
Published by: 917372 on February 27, 2012 16:28
Published by: 917372 on February 27, 2012 16:28
Published by: 917372 on February 27, 2012 16:29
Published by: 917372 on February 27, 2012 16:31Hello
Welcome to the forum!
Here's one way:
SELECT (SELECT col1 FROM tblA WHERE col1 = 'val1') AS col1 , (SELECT col2 FROM tblB WHERE col2 = 'val2') AS col2 FROM dual;
This will work as long as the two subqueries return 0 or 1 rank. If it is 0, the corresponding column will be NULL, as you requested.
You could also each table of double outer join, or do an OUTER JOIN COMPLETE queries under 2. I think that the approach of scalar subquery (above) is the easiest way.
-
combinations, nested queries
Hello everyone,
We need to change technologies according to the needs of the company and we would like to understand request.
Select t1.fld1 as class, v2.section, v1.duration,
rownum, nest queries, dot operator and combinations make us confused.
T1.fld2 as start_date, end_date as t1.fld3,
(t1.fld2 + v2.section - 1) as sectiondate
Of
(select Fld1 as class, ((fld3-fld2) + 1) as the length)
from t1
) v1
, (select rownum as object section where rownum < 180) v2
t1
where t1.fld1 = v1.class
and v2.section < = v1.duration
We need help with this.
Thanks in advance,
NYHello
I don't have your question. In your request, that you do not use one of the columns object, you simply use a virtual column rownum to get an output of 180 lines with value 1-179. This array with the value 1 to 179 you set v2 table in your SQL.
Concerning
-
Hello ~
I have several queries I want to be able to combine to get a report that looks like this:
Troop property damage accident death
7 2 1 B
7 D 0 0
A 6 1 0
F 2 0 0
Totals: 22 3 1
Here are my questions below:
I am able to get the first request appears correctly, but when I try to add the second and the third query, it does not display the way I want to.select distinct officer_troop as "Troop", accident as "Accident", accident_type as "Type", count(accident_type) as "Property Damage" from pursuit where accident_type = 'PROPERTY' union all select count(accident_type)AS "INJURY" from pursuit where accident_type = 'INJURY' union all select count(accident_type)AS "FATALITY" from pursuit where accident_type = 'FATALITY' group by officer_troop,accident_type,accident order by count(accident_type) desc;
Anyone able to help? Thank you
DeannaIt seems that you need a pivot query, rather than a set of union alls
for example:
select officer_troop as "Troop", sum(decode(accident_type, 'PROPERTY', 1, 0) "Property Damage" from pursuit group by officer_troop
I'll leave it to you to add additional columns as needed
-
The combination of queries? (division)
{color: #000080} I have two queries what results I use to get the rate or percentage. Here they are: {color}
< pre >
SELECT
COUNT (hd. ENTRY_ID)
Of
HPD_HELP_DESK_ASSIGNMENT_LOG,
HPD_HELP_DESK hd,
CTM_SUPPORT_GROUP ResolvedByGroup,
CTM_SUPPORT_GROUP,
CTM_SUPPORT_GROUP_ASSOC_LOOKUP
WHERE
HD. REPORTED_DATE & gt; = ((SYSDATE-TO_DATE (' 01/01/1970 00:00:00 ',' JJ-MM-AAAA HH24:Mi:SS')) * (24*60*60))-(24*60*60) reported 24 past hours. < br / > AND < br / > (hd.)) ASSIGNED_GROUP = "SERVICEDESK" GOLD hd. ASSIGNED_GROUP = "Z-SERVICEDESK") < br / > AND (hd. RESOLVED_BY_GROUP = "SERVICEDESK" GOLD hd. RESOLVED_BY_GROUP = "Z-SERVICEDESK") < br / > AND hd.resolved_by_group = hd.assigned_group < br / > AND hd.total_transfers = 0 < br / > AND (hd. LAST_RESOLVED_DATE - hd. REPORTED_DATE) & lt; (60 * 60 * 1) resolved in 1hours
AND hd. AUTHOR = hd. ASSIGNEE_LOGIN_ID
AND hd. SERVICE_TYPE = 0
AND
(HPD_HELP_DESK_ASSIGNMENT_LOG. INCIDENT_ENTRY_ID ()) = hd. ENTRY_ID)
AND (CTM_SUPPORT_GROUP_ASSOC_LOOKUP. Login_id = hd. TRANSMITTER)
AND (CTM_SUPPORT_GROUP_ASSOC_LOOKUP. DEFAULT_X = 0)
AND (CTM_SUPPORT_GROUP. SUPPORT_GROUP_ID (+) is hd. ASSIGNED_GROUP_ID)
AND (hd. RESOLVED_BY_GROUP = ResolvedByGroup.SUPPORT_GROUP_NAME (+))
AND
(
CTM_SUPPORT_GROUP_ASSOC_LOOKUP. SUPPORT_GROUP_NAME in ('service DESK', "Z-SERVICEDESK")
AND
TRUNC (hd. REPORTED_DATE / 86400 + TO_DATE('12/31/1969 5:00:00 PM','MM/DD/YYYY HH:MI:SS AM')) BETWEEN to_date (October 28, 2008 ', 'dd-mm-yyyy') AND to_date (October 28, 2008 ', 'dd-mm-yyyy')
)
< / pre >
{color: #000080}
and {color}
< pre >
SELECT
COUNT (hd. ENTRY_ID)
Of
HPD_HELP_DESK hd,
CTM_SUPPORT_GROUP_ASSOC_LOOKUP
WHERE
HD. REPORTED_DATE & gt; = ((SYSDATE-TO_DATE (' 01/01/1970 00:00:00 ',' JJ-MM-AAAA HH24:Mi:SS')) * (24*60*60))-(24*60*60) - reported past 24 hours.)) < br / > AND hd. SERVICE_TYPE = 0 < br / > AND (CTM_SUPPORT_GROUP_ASSOC_LOOKUP. Login_id = hd. SUBMITTER) < br / > AND (CTM_SUPPORT_GROUP_ASSOC_LOOKUP. DEFAULT_X = 0) < br / > AND < br / > (< br / > CTM_SUPPORT_GROUP_ASSOC_LOOKUP.) SUPPORT_GROUP_NAME In ('Service DESK', "Z-SERVICEDESK") < br / > AND < br / > TRUNC (hd. SUBMIT_DATE / 86400 + TO_DATE('12/31/1969 5:00:00 PM','MM/DD/YYYY HH:MI:SS AM')) BETWEEN to_date (October 28, 2008 ', 'dd-mm-yyyy') AND to_date (October 28, 2008 ', 'dd-mm-yyyy') < br / >) < br / > < / pre > < br / > < br / > {color: #000080}
all I get as a result of the first query is divided by the result of the second query. Is it possible to combine these two queries and come up with one that gives me the percentage/rate?
Thanks in advance! {color}In a very simplistic way, they can be combined like this:
WITH t1 AS (SELECT COUNT( hd.ENTRY_ID ) c1 FROM HPD_HELP_DESK_ASSIGNMENT_LOG , HPD_HELP_DESK hd , CTM_SUPPORT_GROUP ResolvedByGroup , CTM_SUPPORT_GROUP , CTM_SUPPORT_GROUP_ASSOC_LOOKUP WHERE hd.REPORTED_DATE >=(( SYSDATE - TO_DATE( '1-1-1970 00:00:00', 'MM-DD-YYYY HH24:Mi:SS' ) ) *( 24 * 60 * 60 ) ) -( 24 * 60 * 60 ) --Reported last 24 hrs. AND ( hd.ASSIGNED_GROUP = 'SERVICEDESK' OR hd.ASSIGNED_GROUP = 'Z-SERVICEDESK' ) AND ( hd.RESOLVED_BY_GROUP = 'SERVICEDESK' OR hd.RESOLVED_BY_GROUP = 'Z-SERVICEDESK' ) AND hd.resolved_by_group = hd.assigned_group AND hd.total_transfers = 0 AND ( hd.LAST_RESOLVED_DATE - hd.REPORTED_DATE ) <( 60 * 60 * 1 ) --resolved within 1hours AND hd.SUBMITTER = hd.ASSIGNEE_LOGIN_ID AND hd.SERVICE_TYPE = 0 AND ( HPD_HELP_DESK_ASSIGNMENT_LOG.INCIDENT_ENTRY_ID(+) = hd.ENTRY_ID ) AND ( CTM_SUPPORT_GROUP_ASSOC_LOOKUP.LOGIN_ID = hd.SUBMITTER ) AND ( CTM_SUPPORT_GROUP_ASSOC_LOOKUP.DEFAULT_X = 0 ) AND ( CTM_SUPPORT_GROUP.SUPPORT_GROUP_ID(+) = hd.ASSIGNED_GROUP_ID ) AND ( hd.RESOLVED_BY_GROUP = ResolvedByGroup.SUPPORT_GROUP_NAME(+) ) AND ( CTM_SUPPORT_GROUP_ASSOC_LOOKUP.SUPPORT_GROUP_NAME IN( 'SERVICEDESK', 'Z-SERVICEDESK' ) AND TRUNC( hd.REPORTED_DATE / 86400 + TO_DATE( '12/31/1969 5:00:00 PM', 'MM/DD/YYYY HH:MI:SS AM' ) ) BETWEEN to_date( '28-10-2008', 'dd-mm-yyyy' ) AND to_date( '28-10-2008', 'dd-mm-yyyy' ) ) ) , t2 AS (SELECT COUNT( hd.ENTRY_ID ) c2 FROM HPD_HELP_DESK hd , CTM_SUPPORT_GROUP_ASSOC_LOOKUP WHERE hd.REPORTED_DATE >=(( SYSDATE - TO_DATE( '1-1-1970 00:00:00', 'MM-DD-YYYY HH24:Mi:SS' ) ) *( 24 * 60 * 60 ) ) -( 24 * 60 * 60 ) --Reported last 24 hrs. AND hd.SERVICE_TYPE = 0 AND ( CTM_SUPPORT_GROUP_ASSOC_LOOKUP.LOGIN_ID = hd.SUBMITTER ) AND ( CTM_SUPPORT_GROUP_ASSOC_LOOKUP.DEFAULT_X = 0 ) AND ( CTM_SUPPORT_GROUP_ASSOC_LOOKUP.SUPPORT_GROUP_NAME IN( 'SERVICEDESK', 'Z-SERVICEDESK' ) AND TRUNC( hd.SUBMIT_DATE / 86400 + TO_DATE( '12/31/1969 5:00:00 PM', 'MM/DD/YYYY HH:MI:SS AM' ) ) BETWEEN to_date( '28-10-2008', 'dd-mm-yyyy' ) AND to_date( '28-10-2008', 'dd-mm-yyyy' ) ) ) SELECT c1 / c2 FROM t1, t2;
Not knowing a lot about your tables and the selectivity of your questions, I am not sure how to move the two counts in the same query. You say that the first query is more selective than the second, so any effort to combine the two need to widen the scope of records returned by the first query must match that of the second query without losing selectivity of the County is in the first. This can be possible by relaxing the requirements in the where clause and moving them in a CASE statement in the COUNT function:
COUNT(CASE WHEN expression THEN hd.entry_id ELSE null END)
Published by: Sentinel on October 28, 2008 09:22
-
Table 1: importContact (e-mail, name, userIDFK, contactIDFK)
Table 2: users (e-mail, name, userIDFK)
Currently Im using two queries to insert lines in importContact to achieve what I want:
(1) INSERT INTO importedContacts (email, name, userIDFK) VALUES (EMAIL HERE, NAME HERE, name of USER HERE)
(2) importedContacts UPDATE I have
SET i.contactIDFK = (SELECT u.userID FROM users WHERE i.email = u.email u)
WHERE userIDFK =? AND EXISTS (SELECT u.userID FROM users WHERE i.email = u.email u)
How I would combine the above two questions so instead of inserting first email, name, user name and contactIDFK then to do it in a single queryAs
INSERT INTO importedContacts (email,name,userIDFK, contactIdFK ) VALUES (EMAIL HERE,NAME HERE,USERID HERE, (SELECT u.userID FROM users u WHERE u.email = 'Email here') )
-
You can combine multiple queries in one?
I have a table of database options for additions to homes. I have another table for the categories for these options. Now I do a lot of queries for each individual category of the options. It looks like this:
< / cfquery >
< cfquery datasource = "applewood" username = "username" password = "password" name = "getCategory2" >
SELECT *.
From op_categories WHERE idOpCategories = 3
< / cfquery >
< cfquery datasource = "applewood" username = "username" password = "password" name = "getCategory3" >
SELECT *.
From op_categories WHERE idOpCategories = 4
< / cfquery >
.. and so on. Is there a way to make 1 query that finds each WHERE clause? I want it to look at this on a single page:
Category 1 category 2 category 3
--------------- ----------------- ----------------
Option 1 Option 1 Option 1
Option 2 Option 2 Option 2
Option 3 Option 3 Option 3
Any help would be appreciated.
What of this...
SELECT *.
Of op_categories WHERE idOpCategories in (3.4)
-
Help to combine the two queries with dependencies
Combining two queries with dependencies:First ask: Returns USER_ID that has a type of access to a table with the OWNER (I also shoot the TLA of the USER_ID standard: ' of TLA #)Select distinct SUBSTR (DBA_USERS. Username, 2, 3) AS TLA
DBA_USERS. Username USED_ID
DBA_TAB_PRIVS. Owner OWNER
from DBA_USERS
DBA_ROLE_PRIVS
DBA_TAB_PRIVS
where DBA_USERS. Username = DBA_ROLE_PRIVS. Dealer
and DBA_USERS.default_tablespace not in ('SYSTEM', "SYSAUX")
and DBA_USERS. Username like would be %'
and DBA_ROLE_PRIVS. Granted_role = DBA_TAB_PRIVS. Dealer
and SUBSTR (DBA_USERS. Username, 2, 3) <>DBA_TAB_PRIVS. Owner
;
Example of results (red font used in the last citation):TLA USED_ID OWNER
--- ------------------------------ ------------------------------
DGTX999 GTX GRR
DGTX999 GTX ABG
DGTX999 GTX HTC
FWS DFWS999 GRR
OCN DOCN999 GRR
RHR DRHR999 DAS
ETM DETM999 DAS
FWS DFWS995 DAS
CD DCDS999 DAS
ABE DABE999 DAS
Second request: matches the USER name (same standards as above) and MACHINES (filter PC connections) and the number of connections made ofSelect DBA_USERS. Username
DBA_HIST_ACTIVE_SESS_HISTORY. Machine
COUNT (*) AS CONN_COUNT
of DBA_HIST_ACTIVE_SESS_HISTORY
DBA_USERS
where DBA_HIST_ACTIVE_SESS_HISTORY. User_id = DBA_USERS. User_id
and DBA_USERS. Username like would be %'
and DBA_HIST_ACTIVE_SESS_HISTORY. Machine not as "WINAD%\%-%".
Group of DBA_USERS. Username
DBA_HIST_ACTIVE_SESS_HISTORY. Machine
order by 1
3 desc;
Example of results (red font used in the last citation):MACHINE CONN_COUNT USERNAME
--------------- ------------------------- ----------
DFWS999 home13e0 7557
DGAM800 vu1246 37
DGAM999 vu1246 2558
DABE999 back18cb 4639
DINL888 home162f 84
DFWS999 WINDAD\OMHQ58BF 178
DCDS999 back18cb 788
DGTX999 home18c8 7
DGTX999 home13d3 62
DOCN999 vu1261 44
DFWS999 back1976 3
DCDS999 home18c8 173
DGTX999 home19c9 13
What I'd like to have (just made two first USER_IDs from the first query) (COL duplicated for each separate owner 1-4). So 3 machines and 3 owners would result in 9 lines (I could reorganize the collar and use a 'pause'):
TLA USED_ID MACHINE CONN_COUNT OWNER
--- ------------------------------ ------------------------- ---------- ------------------------------
GTX DGTX999 home13d3 62 GRR
Home18c8 GTX DGTX999 7 GRR
DGTX999 GTX home19c9 GRR 6
GTX DGTX999 home13d3 62 ABG
DGTX999 GTX home18c8 ABG 7
DGTX999 GTX home19c9 6 GBS
GTX DGTX999 home13d3 62 CTH
DGTX999 GTX HTC 7 home18c8
DGTX999 GTX home19c9 6 HTC
FWS DFWS999 home13e0 7557 GRR
FWS DFWS999 WINDAD\OMHQ58BF 178 GRR
FWS DFWS999 back1976 GRR 3
So it would be logically read: TLA as USER_ID of MACHINE, CONN_COUNT consultation times: OWNER information.Thought as only those with the necessary values. Just try this and let me know in the case of all conflicts in the output.
WITH T1 AS)
Select distinct SUBSTR (DBA_USERS. Username, 2, 3) AS TLA
DBA_USERS. Username USED_ID
DBA_TAB_PRIVS. Owner OWNER
ROWNUM RN
from DBA_USERS
DBA_ROLE_PRIVS
DBA_TAB_PRIVS
where DBA_USERS. Username = DBA_ROLE_PRIVS. Dealer
and DBA_USERS.default_tablespace not in ('SYSTEM', "SYSAUX")
and DBA_USERS. Username like would be %'
and DBA_ROLE_PRIVS. Granted_role = DBA_TAB_PRIVS. Dealer
and SUBSTR (DBA_USERS. Username, 2, 3) <> DBA_TAB_PRIVS. Owner),
() AS T2
Select DBA_USERS. Username
DBA_HIST_ACTIVE_SESS_HISTORY. Machine
COUNT (*) AS CONN_COUNT
of DBA_HIST_ACTIVE_SESS_HISTORY
DBA_USERS
where DBA_HIST_ACTIVE_SESS_HISTORY. User_id = DBA_USERS. User_id
and DBA_USERS. Username like would be %'
and DBA_HIST_ACTIVE_SESS_HISTORY. Machine not as "WINAD%\%-%".
Group of DBA_USERS. Username
DBA_HIST_ACTIVE_SESS_HISTORY. Machine
order by 1
3 desc)
SELECT T1. TLA
, T1. USED_ID
, T2. MACHINE
, T2. CONN_COUNT
, T1. OWNER
FROM T1
T2
WHERE T1. USED_ID = T2. USER NAME;
-
Combine queries to get the result set with max Y
Hello
I use forms 6i and db 10.2.0.1.0
With the query below
the result set isSelect ufam_usrgrp,ufam_filegrp,ufam_read,ufam_write,ufam_overwrite,ufam_delete from usr_file_access_master Where ufam_ecode = '0004108';
Another queryUFAM_USRGRP UFAM_FILEGRP UFA UFA UFA UFA --------------- --------------- --- --- --- --- MGMNT CV Y Y Y Y EMPLOYEE GENERAL Y N N N EMPLOYEE PERSONAL Y N N N
gives the resultSelect uul_usrgrp, ufl_file_grp,ufl_read,ufl_write,ufl_overwrite,ufl_delete from usr_usrgrp_lnk,USRGRP_FILEGRP_LINK Where usr_usrgrp_lnk.uul_usrgrp = USRGRP_FILEGRP_LINK.UFL_USR_GRP and usr_usrgrp_lnk.uul_ecode = '0004108'
I need to combine these two queries to get a separate result set with maximum YUUL_USRGRP UFL_FILE_GRP UFL UFL UFL UFL --------------- --------------- --- --- --- --- MGMNT GENERAL Y Y Y Y EMPLOYEE GENERAL Y Y N N MGMNT CV Y N N N
Like here "MGMNT CV" is repeated in both the result set, but the first has more, then it should come from the combined result set. reverse-case also the same (such as "EMPLOYEE GENERAL")
So I want to combine the queries so that I get the result as set below
Please help me to combine these queriesUserGroup FileGroup Rd Wrt Owrt Del --------------- --------------- --- --- --- --- MGMNT GENERAL Y Y Y Y EMPLOYEE GENERAL Y Y N N MGMNT CV Y Y Y Y EMPLOYEE PERSONAL Y N N N
Published by: Divya on August 14, 2011 21:24
Changed the result set and the last exitNOT TESTED!
select y.uul_usrgrp, y.ufl_file_grp, greatest(ufl_read,nvl(ufam_read,' ')) ufl_read, greatest(ufl_write,nvl(ufam_write,' ')) ufl_write, greatest(ufl_overwrite,nvl(ufam_overwrite,' ')) ufl_overwrite, greatest(ufl_delete,nvl(ufam_delete,' ')) ufl_delete from (select ufam_usrgrp,ufam_filegrp,ufam_read,ufam_write,ufam_overwrite,ufam_delete from usr_file_access_master Where ufam_ecode = '0004108' ) x, (select uul_usrgrp, ufl_file_grp,ufl_read,ufl_write,ufl_overwrite,ufl_delete from usr_usrgrp_lnk,USRGRP_FILEGRP_LINK Where usr_usrgrp_lnk.uul_usrgrp = USRGRP_FILEGRP_LINK.UFL_USR_GRP and usr_usrgrp_lnk.uul_ecode = '0004108' ) y where y.uul_usrgrp = x.ufam_usrgrp(+) and y.ufl_file_grp = x.ufam_filegrp(+)
Concerning
Etbin
Edited by: Etbin on 14.8.2011 13:08
deleted by group -
How to combine multiple regex queries in a script?
Hello
is it possible to combine several queries regex in JavaScript? I export text from a database with custom labels and regex queries interpret the text AND character style replacements.
example of
Let's say my exported text is as follows
"I have a very large text of < tag_bold > < / tag_bold > that includes a large number of styles of different characters, such as < tag_bold >"BOLD"< / tag_bold >, < tag_italic > italic < / tag_italic >, < tag_bold >"BOLD"with certain < tag_bold_underline > underlined words < / tag_bold_underline > < / tag_bold >. ,
«to the words with different < tag_size-2 > text size < / tag_size-2 >»
The result I want is
"I have a very large text that includes a large number of styles of different characters, such as bold, italic,
"BOLD", with a few words that are underlined, or never words with different text size.
Note that all the tags open and close in the same paragraph and there's nested pairs of tags in some cases. If I run my requests (more than 20) of the outer pair the inner exception, i.e.:
< tag_bold >... < / tag_bold >
< tag_italic >... < / tag_italic >
< tag_size-2 >... < / tag_size-2 >
< tag_bold_underline >... < / tag_bold_underline >
Thanks in advance for your help
DPS
If your character style name and tag name so I think it's a complete solution for you
try code below:
myDoc var = app.activeDocument;
var charastyles = myDoc.characterStyles.everyItem () .name;
for (a = 1;
{
repl_charastyles (charastyles [a])
}
function repl_charastyles (charstyle)
{
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = '<' +="" charstyle="" +="" '="">' + '(.+?)' +="" charstyle="" +="" '="">';
app.changeGrepPreferences.changeTo = ' $1 ';
app.changeGrepPreferences.appliedCharacterStyle = charstyle;
app.activeDocument.changeGrep ();
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
}
Shonky -
Need help with the use of GROUP BY in a select statement UNION
I am writing a query that allows to combine a legacy system that interfaces it is trial balance in the Oracle of R12 GL. It was only meant to continue for a month or two, but it is likely to continue for 6 months. Please Auditors Auditors, to provide proof that the system is in balance with Oracle GL. By my verification requirements, I need to make a full reconciliation from the month of conversion (life in the amount of date), then PTD for each month.
The legacy account is placed in attribute1 on the lines of the journals. Uses of the old system balancing segments that are also used on the platform in Oracle for this division, i.e., Procure-to-Pay has been cut over Oracle, but not everything yet. So, I can't count on the GL_BALANCES table for the info, I get from the JE_LINES.
My problem is not the only request for the month. But when I try to combine the queries with a Union, to aggregation of each measurement period in its own column, the group is necessary after each selected instruction rather than allowing me to put at the end of the UNION. (When I put the group by at the end of the UNION, I have the 'not one group' function)
So I get duplicate for each month of discrete measure accounts. When I duplicate in my Oracle database accounts, I can't count on the VLOOKUP function in excel to exactly match an account of inheritance. I know there are more sophisticated ways to provide this output, but I'm hoping to get this info in a simple query.
Thank you in advance for any advice you can provide
Example of data output (the goal for me is to get the two rows to appear as one based on common points on the LEGACY_ACCOUNT and the ORACLE ACCOUNT
The LEGACY ACCOUNT ORACLE ACCOUNT JUN_15 JUL_15 AUG_15 SEP_15 OCT_15 NOV_15 DEC_15 010000001109000003584 190-600552-1001-100231-000-0000-0000-0000 0 0 -242961.04 0 0 0 0 010000001109000003584 190-600552-1001-100231-000-0000-0000-0000 0 192588.02 0 0 0 0 0 Here is a simplified version of my code that returns both records. In my research, I had found a number of conversations where it has been shown that the group could be put at the end of the select statement. However, when I remove the group from the first select statement I get SQL error: ORA-00937: not a function of simple-group
Select
l.attribute1 LEGACY_ACCOUNT,
C.SEGMENT1: '-' | C.SEGMENT2: '-' | C.SEGMENT3: '-' | C.SEGMENT4: '-' | C.SEGMENT5: '-' | C.SEGMENT6: '-' | C.SEGMENT7: '-' | COMBINATION OF C.SEGMENT8,
JUN_15 TO_NUMBER('0').
JUL_15, sum (NVL(l.accounted_dr,0.00)-NVL(l.accounted_cr,0.00)),
TO_NUMBER('0') AUG_15.
TO_NUMBER('0') SEP_15.
TO_NUMBER('0') OCT_15.
TO_NUMBER('0') NOV_15.
DEC_15 TO_NUMBER('0')
Of
b GL.gl_je_batches,
GL.gl_je_headers h,
GL.gl_je_lines l,
GL.gl_code_combinations c,
GL.gl_je_sources_tl j
where b.je_batch_id = h.je_batch_id
and h.je_header_id = l.je_header_id
and l.code_combination_id = c.code_combination_id
and h.je_source = j.je_source_name
and c.segment1 ('190 ', '191', '192', '193', '194', ' 195 ', ' 196',' 197', ' 198 ', ' 199',)
('200 ', '203', ' 205', '206 ', '330', '331', '332',' 333 ', ' 334',' 335', ' 336 ', ' 337')
and j.language = 'en '.
and h.PERIOD_NAME ("JUL-15'")
Group
l.attribute1,
C.SEGMENT1: '-' | C.SEGMENT2: '-' | C.SEGMENT3: '-' | C.SEGMENT4: '-' | C.SEGMENT5: '-' | C.SEGMENT6: '-' | C.SEGMENT7: '-' | C.SEGMENT8
UNION
Select
l.attribute1 LEGACY_ACCOUNT,
C.SEGMENT1: '-' | C.SEGMENT2: '-' | C.SEGMENT3: '-' | C.SEGMENT4: '-' | C.SEGMENT5: '-' | C.SEGMENT6: '-' | C.SEGMENT7: '-' | COMBINATION OF C.SEGMENT8,
JUN_15 TO_NUMBER('0').
TO_NUMBER('0') JUL_15.
AUG_15, sum (NVL(l.accounted_dr,0.00)-NVL(l.accounted_cr,0.00)),
TO_NUMBER('0') SEP_15.
TO_NUMBER('0') OCT_15.
TO_NUMBER('0') NOV_15.
DEC_15 TO_NUMBER('0')
Of
b GL.gl_je_batches,
GL.gl_je_headers h,
GL.gl_je_lines l,
GL.gl_code_combinations c,
GL.gl_je_sources_tl j
where b.je_batch_id = h.je_batch_id
and h.je_header_id = l.je_header_id
and l.code_combination_id = c.code_combination_id
and h.je_source = j.je_source_name
and c.segment1 ('190 ', '191', '192', '193', '194', ' 195 ', ' 196',' 197', ' 198 ', ' 199',)
('200 ', '203', ' 205', '206 ', '330', '331', '332',' 333 ', ' 334',' 335', ' 336 ', ' 337')
and j.language = 'en '.
and h.PERIOD_NAME ("AUG-15'")
Group
l.attribute1,
C.SEGMENT1: '-' | C.SEGMENT2: '-' | C.SEGMENT3: '-' | C.SEGMENT4: '-' | C.SEGMENT5: '-' | C.SEGMENT6: '-' | C.SEGMENT7: '-' | C.SEGMENT8
order by 1
Is there a good reason to make this period both as a series of trade unions? This looks like a classic pivot for me query. This will make a way through the tables and should get the desired results.
Select l.attribute1 legacy_account,
c.Segment1: '-' | c.Segment2: '-' | c.segment3: '-' | c.segment4: '-' |
c.segment5: '-' | c.segment6: '-' | c.segment7: '-' | combination of c.segment8,
sum (case when h.period_name = 'JUN-15'
then nvl(l.accounted_dr,0.00)-nvl(l.accounted_cr,0.00)
otherwise 0 end) jun_15,.
sum (case when h.period_name = 'JUL-15'
then nvl(l.accounted_dr,0.00)-nvl(l.accounted_cr,0.00)
otherwise 0 end) jul_15,.
- and similar to DEC - 15
GL.gl_je_batches b, gl.gl_je_headers h, gl.gl_je_lines l.
GL.gl_code_combinations c, gl.gl_je_sources_tl j
where b.je_batch_id = h.je_batch_id
and h.je_header_id = l.je_header_id
and l.code_combination_id = c.code_combination_id
and h.je_source = j.je_source_name
and c.segment1 ('190', '191', '192', '193', '194', '195',' 196', ' 197',
'198 ', '199', '200', '203', '205' ', 206',' 330 ', ' 331',
"332 ', '333', '334', '335',' 336 ', ' 337')
and j.language = 'en '.
and h.period_name (' Jun-15', ' 15 JUL', ' AUG-15'... "" ")
L.attribute1 group,
c.Segment1: '-' | c.Segment2: '-' | c.segment3: '-' |
c.segment4: '-' | c.segment5: '-' | c.segment6: '-' |
c.segment7: '-' | c.segment8
If you're on the 11G version of the database, you might want to look at the PIVOT keyword that will do the same thing in a more concise expression.
John
-
vCenter Linked Mode and Perl SDK
Hello
our VMware environment is divided into two physical places represented as two instances of vCenter. The two vCenters are interconnected. I think that its Mode called "related"?
Is it possible to use the Perl SDK also bound mode? Currently, I have to manually interrogate both our vCenters and then sort out myself.
(1) How to configure Perl SDK so I only authenticate once against our environment in Linked mode?
(2) How can I build queries against the API so results will include objects in the two vCenters? That is to say. If I run a ' Vim::find_entity_views (view_type = > 'VirtualMachine') "I want to get all the objects 'VirtualMachine' in the two vCenters I can avoid running two separate queries and then later combining query results? ".
Thank you!
Thomas Willert
It is not a published API method, but there is a way to get the vCenter server list in a group of related modes. I have an explanation and sample code: http://www.virtuin.com/2012/12/querying-vcenter-linked-mode-with.html
With respect to authentication, if your vCenter instances use the same permissions (which is recommended), then it's just a matter to authenticate each vCenter. This is what the native client as well (if you have never installed vCenters with different permissions, you will see the login for each vCenter prompt).
If you look at the blog post I linked earlier, you self an example of authentication each vCenter as well. Basically you call Util::connect() two times, once for each of your URL for vCenter. However, do not delete the global VIM uses the SDK package, or it will default to the last vCenter. I show in the example script: LinkedModeExample.pl
With respect to the combination of queries... not so easy. You need to redesign each vCenter with $vim-> find_entity_views(). Now on a more advanced note, API is powerful enough to make custom inventory queries, you can usually pick up and keep the updates in your objects.
What I would recommend as a simple approach is two calls to find_entity_views, then push them in a hash or an array. You'll just want to use the UUID vCenter:
$vc_uuid is $vim1-> get_service_content()-> {'about'}-> {'instanceUuid'};.
The instanceUuid has been added in vCenter 4.x and later versions (do not have in the past 2.5 vCenter instances). Then use this instanceUuid + moref as hash keys. This is important because the morefs can be duplicated between vCenters.
So, you can then create a hash:
My % vm_hash;
foreach my {$entity (@$vm_views)}
My $moref = $entity-> {'mo_ref'}-> {'value'}; # will be vm-# for virtual machines
$vm_hash {$vc_uuid.} "+". $moref} = $entity;
}
Then you can quickly research specific VMs and keep separate them between vCenters.
You'll find it works for simple data queries, but you start to get more items of inventory (say for an inventory report), the relationship becomes more complex and the number of objects grow. I did work to push these values in a database and files (including by running it on 5 or less than weight and WaitForUpdatesEx), excel, which works well if you have the time to build the DB and the work of database object schemas. Just use instanceUuid + Moref value as primary key to prevent any moref vCenter cross reuse value.
The other option is that the vim reference is added to each object, so you can just get the data of each entity:
foreach my {$vm (@$vm_views)}
Print "VM:". "." $vm-> {'name'}. "\n";
Print "InstanceUuid VC:". $vm-> {'vim'}-> {'service_content'}-> {'about'}-> {'instanceUuid'}. "\n";
Print "ServiceUrl VC:". $vm-> {'vim'}-> {'service_url'}. "\n";
}
I have a project that I tinker with in my spare time (which is rare these days) which aims to consolidate multiple vCenters into one database for queries and reports, but I didn't get far enough away from share it (very rude, but works for a subset of data at present, but it is very effective for collecting loose on<5s intervals).="">5s>
You can also look into VMware Orchestrator. Orchestrator can connect to multiple vCenters and caches data for access by automation. According to your WAN performance, he can work a geographic site and make sure that you need (just watch the moref, names of entities and other potential overlap between vCenters) aggregated data.
-
Design taking into account future growth.
Hi, I use 11.2.0.3 version of oracle.
We are in the process on the introduction of a new table in our database, so it expected to grow considerably(~50GB) in the future, want to decide its strategy of indexing/partitioning from its inception. I have provided.
(1) this table is to have two important columns customerid, taskid for each customer id it will be 10 different taskid and there will be about 200 clients whereas commercial future. the two columns are varchar2. a status (varchar2) column that contains 5 different registration and other status 8 columns describing more details.
(2) this table will not have a primary key, because he will accept customer file data, and he must accept the records in doubles too without the slightest mistake on.
(3) for most in functionality, this table is queried using two main column (custometid, taskid) and the app guys confirm they will not be able to query the table using the date column.
So I think
composite(List-List) of partitioning the table based on customerid (partition) and taskid (subpartition)
should I create global index on customerid and partition local index taskid.
or
single global index on (customerid, taskid)?.Please suggest.
933257 wrote:
He should spend in the future considerably(~50GB)
(1) this table is to have two important columns customerid, taskid for each customer id it will be 10 different taskid and there will be about 200 clients whereas commercial future. the two columns are varchar2. a status (varchar2) column that contains 5 different registration and other status 8 columns describing more details.
(3) for most in functionality, this table is queried using two main column (custometid, taskid) and the app guys confirm they will not be able to query the table using the date column.
composite(List-List) of partitioning the table based on customerid (partition) and taskid (subpartition)
50 GB, 200 customerid, 10 taskids - is 2 000 combinations, which means 25 MB by combination, and queries are based on a single client and task. -unless there is any other queries involved predicates will be very slowly as time goes - especially if you have no way to "time-dependent" to avoid the older data.
composite(List-List) is the best bet - but you don't need a clue to one of these two columns because any data segment will be only the data for a given client and task; the only clues you need are on the other predicates, and you can see that local indexing for columns is all you need.
The threat of execution for local indexing appears only if you have specified (a) only the task id and some other predicate you must then probe 200 segments data and index; or (b) If you specified either customer or task because that would require a probe of 2 000 data and index segments. If you have specified a client then the additional work done by 10 probes index would probably acceptable to avoid global indexing.
Concerning
Jonathan Lewis
-
I am creating a report that combines 2 queries and displays the Top7 in the combined result set result.
Combining the results is easy, using the feature "Combined results based on the union" page of analysis criteria. However, once I've defined the union it is not possible to add a TopN(..., 7) formula for the final result. I can add the formula to each result set separately before the union, but it does not give the desired result.
Y at - it a trick or a hack to add this field to the set of results within the same analysis? I can get it fact basing a second analysis on that with the result, but surely OBIEE should support this within the same analysis too...
I use OBIEE 11.1.1.6, btw.
Hi KurtGeens,
Have you tried adding a result column and calculate the rank or he is using your custom form.
You can add columns to your UNION query results and all the calculations on the final together. You will be able to view the columns of your two analyses and perform calculations more.
This should be sufficient for most of your needs.
-
-------------------------------------------------------------
I want to combine all queries, but while the combination for the first count of query must be multiplied by 1 and second query count must be multiplied by 2 and third query count must be multiplied by 3 and the fourth number of queries must be multiplied by 4 and fifth query count must be multiplied by 5
--------------------------------------------------------------
(1) select count (*) test where length (message) < = 140 and SMS_TO = "IMI" and Date_Time between to_date('01/08/2011 12:00:00 AM','DD/MM/YYYY HH:MI:SS AM') and to_date('30/08/2011 11:59:59 PM','DD/MM/YYYY HH:MI:SS PM').
(2) count (*) selection of Test where (length (message) > 140 and length (message) < = 280) and SMS_TO = 'IMI' and Date_Time between to_date('01/08/2011 12:00:00 AM','DD/MM/YYYY HH:MI:SS AM') and to_date('30/08/2011 11:59:59 PM','DD/MM/YYYY HH:MI:SS PM').
(3) count (*) selection of Test where (length (message) > 280 and length (message) < = 420) and SMS_TO = 'IMI' and Date_Time between to_date('01/08/2011 12:00:00 AM','DD/MM/YYYY HH:MI:SS AM') and to_date('30/08/2011 11:59:59 PM','DD/MM/YYYY HH:MI:SS PM').
(4) select count (*) from Test where (length (message) > 420 and length (message) < = 560) and SMS_TO = 'IMI' and Date_Time between to_date('01/08/2011 12:00:00 AM','DD/MM/YYYY HH:MI:SS AM') and to_date('30/08/2011 11:59:59 PM','DD/MM/YYYY HH:MI:SS PM').
(5) count (*) selection of Test where (length (message) > 560 and length (message) < = 700) and SMS_TO = 'IMI' and Date_Time between to_date('01/08/2011 12:00:00 AM','DD/MM/YYYY HH:MI:SS AM') and to_date('30/08/2011 11:59:59 PM','DD/MM/YYYY HH:MI:SS PM').909258 wrote:
-------------------------------------------------------------
I want to combine all queries, but while the combination for the first count of query must be multiplied by 1 and second query count must be multiplied by 2 and third query count must be multiplied by 3 and the fourth number of queries must be multiplied by 4 and fifth query count must be multiplied by 5
--------------------------------------------------------------(1) select count (*) test where length (message)<=140 and="" sms_to='IMI' and="" date_time="" between="" to_date('01/08/2011="" 12:00:00="" am','dd/mm/yyyy="" hh:mi:ss="" am')="" and="" to_date('30/08/2011="" 11:59:59="" pm','dd/mm/yyyy="" hh:mi:ss="">=140>
(2) count (*) selection of Test where (length (message) > 140 and length (message)<=280) and="" sms_to='IMI' and="" date_time="" between="" to_date('01/08/2011="" 12:00:00="" am','dd/mm/yyyy="" hh:mi:ss="" am')="" and="" to_date('30/08/2011="" 11:59:59="" pm','dd/mm/yyyy="" hh:mi:ss="">=280)>
(3) count (*) selection of Test where (length (message) > 280 and length (message)<=420) and="" sms_to='IMI' and="" date_time="" between="" to_date('01/08/2011="" 12:00:00="" am','dd/mm/yyyy="" hh:mi:ss="" am')="" and="" to_date('30/08/2011="" 11:59:59="" pm','dd/mm/yyyy="" hh:mi:ss="">=420)>
(4) select count (*) from Test where (length (message) > 420 and length (message)<=560) and="" sms_to='IMI' and="" date_time="" between="" to_date('01/08/2011="" 12:00:00="" am','dd/mm/yyyy="" hh:mi:ss="" am')="" and="" to_date('30/08/2011="" 11:59:59="" pm','dd/mm/yyyy="" hh:mi:ss="">=560)>
(5) count (*) selection of Test where (length (message) > 560 and length (message)<=700) and="" sms_to='IMI' and="" date_time="" between="" to_date('01/08/2011="" 12:00:00="" am','dd/mm/yyyy="" hh:mi:ss="" am')="" and="" to_date('30/08/2011="" 11:59:59="" pm','dd/mm/yyyy="" hh:mi:ss="">=700)>
So what should the results expected/desired look like?
Maybe you are looking for
-
Startup Bootcamp to fix repair partition
Hello Here is the output in the following order: diskutil list Cs diskutil list sudo TPG - vv - r see the/dev/disk0 sudo fdisk/dev/disk0 / dev/disk0 (internal, physical): #: NAME SIZE TYPE IDENTIFIER 0: GUID_partition_scheme * GB 500,1 disk0 1: disk0
-
How can I move the main library of FCPX sys HARD drive to another HARD drive
I am a beginner FCPX... I use an SSD as diss system. I n ' love to load this SSD with such a library. Is it possible to move the main library on another hard drive? A big thank you to you all Michel
-
iTunes is the only program I can run.
I have Windows Vista on my PC. When I install iTunes, iTunes is the only program in the whole of the device (I can't open internet, or any other program). This happened to anyone? How can I fix this, please? Thank you in advance.
-
WinXP2 husbands freezes in a short time after he got on the computer.
My husband was my old computer, Windows XP-2 is loaded on this subject at this time. About 4 weeks, an update automatically which sent his computer in a failure cascade drive. I reformat the hard disk THREE TIMES since that happened. A few minutes
-
Product code for the downloaded software
After the download of Windows XP Home Edition and try to install it, I was for a product code. Where do I get it?