Avoid multiple calls to the same table in SQL
Hi team,
can anyone help me on a technical level with the SQL below.
SELECT MOR. ACE BLEI_CK BLEI_CK FC_CMC_BLBL_BILL_SUMM INNER JOIN ST_ALL_IFP_MEDCR_SUPPL_STG STG MOR ON MOR BLEI_CK = STG. BIL_ENTY_CK AND MOR. BLBL_PAID_STS <>'3' AND MOR. BLBL_DUE_DT = (SELECT MIN (BLBL_DUE_DT) FROM FC_CMC_BLBL_BILL_SUMM WHERE BLEI_CK =. MOR BLEI_CK AND BLBL_PAID_STS <>' 3') INNER JOIN FC_CMC_BLDF_BL_DEFINE BLDF on MOR. BLEI_CK = BLDF. BLEI_CK AND to_date (January 17, 2012 20:32:25 "," MM/DD/YYYY hh24:mi:ss') BETWEEN BLDF. BLDF_EFF_DT AND BLDF. BLDF_TERM_DT WHERE MOR. BLBL_DLNQ_DT + (BLDF. (BLDF_GRACE_PER-2) < to_date (January 17, 2012 20:32:25 "," MM/DD/YYYY hh24:mi:ss') GROUP OF MOR. BLEI_CK ORDER BY BLEI_CK
Here, the FC_CMC_BLBL_BILL_SUMM table is called two times in the same query. How to avoid this problem by using any means or Analytics
Thank you
something like this:
WITH Boop AS (SELECT BLEI_CK
BLBL_DUE_DT
BLBL_DLNQ_DT
ROW_NUMBER() over (ORDER BY BLBl_DUE_DT DESC BLEI_CK PARTITION) AS date_rank
OF FC_CMC_BLBL_BILL_SUMM
WHERE BLBL_PAID_STS <> '3')
SELECT MOR BLEI_CK AS BLEI_CK.
MOR
INNER JOIN ST_ALL_IFP_MEDCR_SUPPL_STG ON (MOR. BLEI_CK = STG STG BIL_ENTY_CK)
INNER JOIN FC_CMC_BLDF_BL_DEFINE BLDF ON (MOR. BLEI_CK = BLDF. BLEI_CK)
WHERE MOR. DATE_RANK = 1
AND MOR. BLBL_DLNQ_DT + (BLDF. BLDF_GRACE_PER-2)< to_date('01/17/2012="" 20:32:25','mm/dd/yyyy="">
AND to_date (January 17, 2012 20:32:25 "," MM/DD/YYYY hh24:mi:ss') BETWEEN BLDF. BLDF_EFF_DT AND BLDF. BLDF_TERM_DT
GROUP OF MOR BLEI_CK.
ORDER BY BOOP. BLEI_CK
/
HTH
Tags: Database
Similar Questions
-
Great love to the people behind this wonderful addition! I also want to be able to call my family threw away and we all in the conversation together. It seems right now it's just a one called. Will there be the ability to have several people on a call at the same time?
Hi, when firefox Hello usable only for a conversation between two people.
multi-party videoconferencing is on the roadmap to long term, but it will take a lot of Engineering (Hello firefox is based on the webrtc standard which is a peer-to-peer protocol between two machines-multipart calls can be a rather difficult thing to understand on this basis).
-
Multiple calls to the same mapid
I have a scenario where there are six dialog boxes that have a help button and should so a CSH topic. My first thought was that I just got a help topic for each dialog box, but then I discovered that each of the six dialog boxes are more or less identical and so can be easily handled by a single help topic. So from where I sit, my options seem to be:
- Several topic ID is a unique mapid (and thus the topic).
- ID of a topic and mapid and let the developer do all the hard work ;-)
Before going to one of these lines, I was wondering how others have dealt with similar scecnarios. What is 'best practice' and pitfalls of each approach. I produce a CHM file. Thanks in advance.
Colum,
I have a lot of card numbers generated automatically by our development tool and all are mapped to a single topic. Since, in our society, I do .hh files so .ali, I can give you a time frame at both ends.
The developer doesn't have to be the one to determine whether multiple dialogs can be described in the same section. My experience with the developers, it's that they think each dialog box is intuitively obvious. The developer will likely have their development tool automatically assign card numbers and each dialog box will be different.
It is not possible for the .hh file contains a unique mapID for several numbers on the card - the developer cannot set a mapID to two different numbers map - so that you will have to do it at the level of the .ali files. You can easily run multiple mapIDs to a single topic, but I don't know how RoboHelp manages this because I do all of the help sensitive to context in WordPad (which is not as difficult as it may seem). I know that the EditMapIDs dialog box in my old (v.8) version of HR is terrible but I expect much improved over the past fifty years...
John
- Several topic ID is a unique mapid (and thus the topic).
-
Multiple count() returns the same table?
Hi all
I have to count number of invoices (several million) related to contracts (aprox. 75000 entries). When I try
Select contract.number, count (bill.id), count (a.id)
contract, invoice, charge a
where bill.contractid = contract.id
and bill.type = 0
and a.contractid = contract.id
and a.type = 1
the result of count (a.id) is always the same as count (bill.id). Knowing well that this is wrong, I tried to change the count() in own - select statements, but this does not help and the performance is less than mediocre.
Does anyone have an idea to get the correct inventory results with a decent return?
Thank you CarstenYou need a group by, not a join double...
select contract.number,bill.type, count(0) from contract,bill where bill.contractid = contract.id and bill.type in (0,1) group by contract.number,bill.type
Or if you want the two types on the same line:
select contract.number,sum(decode(bill.type,0,1,0)) TYPE0, sum(decode(bill.type,1,1,0)) TYPE1 from contract,bill where bill.contractid = contract.id and bill.type in (0,1) group by contract.number
Max
Published by: Massimo Ruocchio on November 30, 2009 15:12
Second option added -
Original title: Multi users
Is it possible to set up for multiple users on the same computer to avoid entering the email and password every time that a new user want to check emails?
Hello
Welcome to the community forums of Microsoft and thanks for posting the question. According to the description, you need help in the creation of multiple user accounts. I've surely you will help find a solution on the issue.
What is the operating system installed on the computer?
User accounts, several people can easily share a single computer. Each person can have a separate user account with unique settings and preferences, such as a screen saver or desktop background. User accounts control files and programs users can access and what types of changes users can make to the computer. As a general rule, you'll want to create standard accounts for most computer users.
If you use Windows Vista or Windows 7, see the article below:
Create a user account
http://Windows.Microsoft.com/en-in/Windows7/create-a-user-account
http://Windows.Microsoft.com/en-in/Windows-Vista/create-a-user-account
For Windows XP users:
How to create and configure user accounts in Windows XP
http://support.Microsoft.com/kb/279783?WA=wsignin1.0
Hope this information helps. Answer please if you have more queries about Windows.
-
How to create multiple hierarchies from the same physical table
Hi all
I have a physical table to join with a fact table: there are 3 different hierarchies, which share the last 2 levels inside the dimension table. It's the logic diagram of hierarchies:
Dimension services
-Business
-Sector
-Type
-Operator
-Product
Partner of dimension
-Partner
-Operator
-Product
Contractor of dimension
-Contractor
-Operator
-Product
All columns are in the same table physical source. I tried to create 3 table logic source from the same physical table, everyone with all the columns and create a hierarchy for each dimension table, but it gives me nQSError: 15011.
Any suggestion? Maybe the physical table alias can help for the creation of tables of different sizes?
Thanks in advance,
ConcerningHello
It is a basic rule that you cannot create multiple hierarchies in a single dimension table, so what you do is create three tables of alias and slip into MDB layer in 3 different sizes and on top these tables create 3 different dimension hierarchies.
Check if useful/correct
Thank you.
-
Report with multiple columns NUMBER of counts of the same table
I am new to discoverer, so I'm a little lost.
I work to create a report to show usage data and Knowledge Base of e-business. I have written using subqueries in SQL query that is in the format:
Solution number | Soultion title | Solution views. Positive feedback | Negative feedback
Title of 12345 _ 345 _ 98 34
The entries 'Views', 'Positive' and 'Negative' are stored in the same table, so I do a count where setid = setid and usedtype = VS, then count where usedtype = usedtype and PF = NF
Discoverer, I can get the number of solution, the title and THE totals but I can't seem to understand how to get an ACCOUNT for three different things from the same table in the columns on the same line.
When I go on change map-> select the items once I select the option NUMBER of the UsedType column in the CS_KB_SET_USED_HISTS table, I can't select it again. I also found way now to add a column based on a query entered.
If someone could help it would be much appreciated.
Thank you
Published by: Toolman21 on December 2, 2010 14:17
_ to correct spacing added.Hello
You can separate the column with a case or decode.
for example to create 2 calculations:case
When usedtype = "PF".
then- that contain both
0 otherwise
endcase
When usedtype = 'NF '.
then- that contain both
0 otherwise
endAfter that, you can create the aggregation count on those.
Tamir
-
place a select query calculation in a different column in the same table
How can I put my calculation result in a column named within the same table?
I have a table called: dgpercentagedatachart
I use the columns of this dgpercentagedatachart: totalcecrating divided by lowestfeederrating times 100 to get the percentage
In the query, I gave the result the Alias of the cal
What I want is to put this result in my application or my calculation (in percentage) in my column "percent" on my table of dgpercentagedatachart vacuum.
How can I configure this syntax?
This is the select query, I came with:
Select dgpercentagedatachart.totalcecrating, dgpercentagedatachart.lowestfeederrating,.
100.00*dgpercentagedatachart.totalcecrating/dgpercentagedatachart.lowestfeederrating as cal
of dgpercentagedatachart;
Here are the results:
CAL lowestfeederrating Totalcecrating
8,978 7.48166666666666666666666666666666666667 120
30.951 25.7925 120
5.04 120 4.2
Hello
2685870 wrote:
How can I put my calculation result in a column named within the same table?
I have a table called: dgpercentagedatachart
I use the columns of this dgpercentagedatachart: totalcecrating divided by lowestfeederrating times 100 to get the percentage
In the query, I gave the result the Alias of the cal
What I want is to put this result in my application or my calculation (in percentage) in my empty column '%' on my table of dgpercentagedatachart .
How can I configure this syntax?
This is the select query, I came with:
Select dgpercentagedatachart.totalcecrating, dgpercentagedatachart.lowestfeederrating,.
100.00*dgpercentagedatachart.totalcecrating/dgpercentagedatachart.lowestfeederrating as cal
of dgpercentagedatachart;
Here are the results:
CAL lowestfeederrating Totalcecrating
8,978 7.48166666666666666666666666666666666667 120
30.951 25.7925 120
5.04 120 4.2
To change an existing column in a table, you can use the UPDATE or MERGE, instructions like this:
UPDATE dgpercentagedatachart
Percentage of VALUE = 100,00 * totalcecrating
/ lowestfeederrating
;
Noramlly, tables is not redundant columns like this. If percent can always be calculated from other columns, then it is probably better to calculate at run time and store it in the database, where you will have to be updated each time the columns it depends on change. You can use a view to avoid having to encode them the calculation.
If you really don't want a column that can be calculated in the same lines other columns, then use a virtual column (if you use Oracle 11 or higher).
I hope that answers your question.
If this isn't the case, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: Re: 2. How can I ask a question on the forums?
-
Loading multiple files using the same interface in ODI
Hi all
We load multiple files using the same interface and get the error "java.sql.SQLException: ORA-00942: table or view does not exist" while inserting record in the staging table. It looks like the same temporary table is used when loading multiple files and the error. Grateful if someone offers a solution to avoid this error.
We use the following KMS:
(1) LKM SQL file
(2) IKM Oracle SQL COMMAND append.
Receive a quick response.
Thank you
RPHello
See this http://odiexperts.com/interface-parallel-execution-a-new-solution
Thank you
Fati -
Open/run multiple windows of the same VI
Hello!
In my current project, I would like to create a user open multiple windows of the same VI. I made a re-entry VI:
This is, actually, a very simple VI which has just a digital control, a loop and a stop button. Then I have a VI that calls the VI re-entrant. I would like it so that whenever the user presses the button "Call home VI", a new window of this VI is created and run.
The first time the button is pressed, the reentrant VI opens and works very well. The title of the VI in the title bar is "Re - Entrant.vi:1 (clone)" (as expected). When I try to launch another instance I get this error:
I'm in LabVIEW 2009.
Thanks for your time.
I think you can do this with a static reference of VI, because it always points to the same instance of the VI (returning).
You must open a new instance using Reference of VI open with option 0 x 08 (prepare environment run).
Hope this helps,
Daniel
-
How to open multiple files with the same extension in one program from the Explorer
I frequently receive several JPG (or whatever extension) files to my clients. On Windows XP, I could just highlight the files I want to open, and then click Open. They would be so open to 1 program cascading. This made it easy when comparing many images. If I do the same thing in Windows 7, it opens the default program several times and puts 1 image of each open program. It is Paint Shop Pro in my case. Thus, instead of so-called images 5 open cascading in Paint Shop Pro... the computer open Paint Shop Pro 5 times with 1 image of each open version of the program. I tried this search like crazy, but cannot find the right thread for an answer. Most of the threads are on the opening of the different file types. My question is only about the opening of multiple files with the same exact file inside 1 free program extension.
Is this the same version of Paint Shop?
One thing you might try is to open Paint Shop, then select and drag all the files in this window of the paint shop. Various programs to manage this type of action differently from the DDE, but it might give you the expected results.
-
comparing string values in the same table
I have a table with ID (14 digit string values) starting with "A". Ex: A21849B1020792. There may be a different ID with the same substring 'B1020792' in the same table, example: A12349B1020792. If this happens, the ID of the last creation date of must be returned in the result. In other words, comparison is done on the same table. "In the example provided, say A12349B1020792 has the date of 1 January 2015 'and A21849B1020792 has date February 1, 2015", since A21849B1020792 has the most recent date, the result must contain only A21849B1020792.
ID create_date
--- ------------------
A21849B1020792 02/01/2015
A12349 B1020792 01/01/2015
A12345B1234567 01/03/2015
A43567B1234567 01/04/2015
Here's the query I used:substr (a.id, 7) select sc, max (a.create_date) cd1
of table a, table b
where a.id! = b.id
and substr (a.id, 7) = substr (b.id, 7)
and a.id like 'A %' and b.id like 'A %' / * (I used a % because I am interested only IDs that begin with A) * /.
and a.id ('A12349B1020792', 'A21849B1020792','A12345B1234567 ','A43567B1234567')
Group of substr (a.id, 7);
Result:
---------
sc cd1
--- ------
B1020792 02/01/2015
B1234567 04/01/2015
There is one thing that I'm not able to do with my request, that is, be able to get real IDs list and not list of substrings. If I added a.id column in the select clause and the group by clause, the query includes both by substr (a.id, 7) and a.id and as a result, the query returns four lines as below:
substr (a.id, 7) select sc, max (a.create_date) cd1, a.id ID
of table a, table b
where a.id! = b.id
and substr (a.id, 7) = substr (b.id, 7)
and a.id like 'A %' and b.id like 'A %' / * (I used a % because I am interested only IDs that begin with A) * /.
and a.id ('A12349B1020792', 'A21849B1020792','A12345B1234567 ','A43567B1234567')
Group by substr (a.id, 7), a.id.
Result:
---------
sc cd1 ID
--- ------ ---------
01/01/2015 A12349B1020792 B1020792
B1020792 01/02/2015 A21849B1020792
B1234567 01/03/2015 A12345B1234567
B1234567 01/04/2015 A43567B1234567
My goal is to retrieve a list of all the unique identifiers that have the later dates.
ID:
---
A21849B1020792
A43567B1234567
Thanks for your time in advance!
Hello
user11951344 wrote:
I have a table with ID (14 digit string values) starting with "A". Ex: A21849B1020792. There may be a different ID with the same substring "B1020792" in the same table, example: A12349B1020792. If this is the case, the ID of the last creation date must be returned in the result. In other words, comparison is done on the same table. "In the example provided, say A12349B1020792 updated 1 January 2015 ' and A21849B1020792 a date February 1, 2015", as A21849B1020792 has the most recent date, the result should contain only the A21849B1020792.
ID create_date
--- ------------------
A21849B1020792 02/01/2015
A12349B1020792 01/01/2015
A12345B1234567 03/01/2015
A43567B1234567 01/04/2015
Here's the query I used:
substr (a.id, 7) select sc, max (a.create_date) cd1
of table a, table b
where a.id! = b.id
and substr (a.id, 7) = substr (b.id, 7)
and a.id like 'A %' and b.id like 'A %' / * (I used a % because I am interested only IDs that begin with A) * /.
and a.id ('A21849B1020792', 'A12345B1234567', 'A12349B1020792', 'A43567B1234567')
Group of substr (a.id, 7);
Result:
---------
sc cd1
--- ------
B1020792 02/01/2015
B1234567 01/04/2015
There is one thing that I am not able to do with my request, that is, the ability to retrieve the list of IDs real and not a list of substrings. If I added a.id column in the select clause and the group by clause, the query groups according to the two substr (a.id, 7) and a.id and as a result, the query returns four lines as below:
substr (a.id, 7) select sc, max (a.create_date) cd1, a.id ID
of table a, table b
where a.id! = b.id
and substr (a.id, 7) = substr (b.id, 7)
and a.id like 'A %' and b.id like 'A %' / * (I used a % because I am interested only IDs that begin with A) * /.
and a.id ('A21849B1020792', 'A12345B1234567', 'A12349B1020792', 'A43567B1234567')
Group by substr (a.id, 7), a.id.
Result:
---------
sc cd1 ID
--- ------ ---------
B1020792 01/01/2015 A12349B1020792
B1020792 02/01/2015 A21849B1020792
B1234567 03/01/2015 A12345B1234567
B1234567 01/04/2015 A43567B1234567
My goal is to retrieve a list of all the unique identifiers that have the later dates.
ID:
---
A21849B1020792
A43567B1234567
Thanks for your time in advance!
If it makes sense to treat the first 6 characters of the ID separately from the rest of the id in this problem, maybe it makes sense to store those two parts of the id in two different columns. Relational databases work best when each column of each row contains 1 single piece of data (at most). It is so fundamental to the design of table that he called the first normal form.
Given that the two parts are stored in column 1, so you can something like this Request Top - N:
WITH got_r_num AS
(
SELECT r.id
r.create_date AS cd1
, RANK () OVER (PARTITION OF SUBSTR (r.id, 7))
ORDER BY r.create_date DESC
) AS r_num
FROM table_x g - g for data values
JOIN table_x r - r for related values
ON SUBSTR (r.id, 7) = SUBSTR (g.id, 7)
WHERE g.id IN ('A12349B1020792'
, "A21849B1020792".
, "A12345B1234567".
, "A43567B1234567".
)
- AND g.id LIKE 'A %' - if necessary. The above condition ensures already g.id start with "A".
AND r.id LIKE 'a % '.
)
SELECT id, create_date
OF got_r_num
WHERE r_num = 1
;
If you would care to post CREATE TABLE and INSERT instructions for the sample data, and then I could test this.
-
Dblink Oracle to sql server, multiple database on the same server sql under a dblink
Hi, we managed to set up an Oracle dblink to sql server and retrieve data.
The user of sql server have been using via dblink has access to multiple databases on the same sql server
But the question is how in oracle (if possible) prepend you the SQL access to this?
For example:
Sqlserver_prod has the user sqlserver_user which seems to be set up as default database sqlserver_db1
But we have select access to sqlserver_db2
all work well as sqlserver_user
Select * from table_fromdb1
Select * from dbo.table_fromdb1
Select * from sqlserver_db1.dbo.table_fromdb1
as does
Select * from sqlserver_db2.dbo.table_fromdb2
more in Oracle
Oracle_db a dblink sqlserver_prod. World connection sqlserver_user
everything works fine
Select * from 'table_fromdb1"@sqlserver_prod '.
Select * from 'dbo '. "table_fromdb1"@sqlserver_prod
But how to (if possible) access from oracle
sqlserver_db2.dbo.table_fromdb2
without having to create a new sqlserver_db2_user referenced in a new dblink
If oracle for oracle would be
Select * from remote_oracle_schema.table@remote_oracle_db
Hello
You cannot select a table in a different SQL * database server from that to which the gateway instance connects.
As stated in the documentation-Oracle® database gateway
Installation and Configuration Guide
11g Release 2 (11.2) for AIX 5 L Based Systems (64-bit), HP - UX
Itanium, Solaris (SPARC 64-Bit), Linux x 86 operating system,
and Linux x 86-64
In the section.
The example SQL Server multiple databases: Configuration of the modem router
A separate instance of the gateway that is required for each SQL Server database. Each
instance needs its own Gateway system ID (SID).
==========
You will need to create a new instance of the gateway for the SQL * Server DB2 as well as a link separate db.
Kind regards
Mike
-
Multiple constraints on the same column
Hello experts, we can use Multiple forced on the same column in oracle as creating table, I want to add a key single and forced to check on the same column is this possible? Thanks in advance,
If you want, seems to be possible
CREATE TABLE t1
(col1 VARCHAR2 (50))
CONSTRAINT ck1 CHECK (col1 IN ('A', 'B', 'C'))
CONSTRAINT PRIMARY KEY (col1) pk1
);
-
Make a column based on another value of the column in the same table
JDev 11.1.1.6.0
It may be a silly question but I'm stuck
I need to conditionally return a column that said Condition is as if the value in the other column of the same table B is equal to F. I should make A column only when this condition is met. I tried the following code:
< af:column sortProperty = "PhoneNumber1." sortable = "false". headerText = "#{bindings." A.hints.PhoneNumber1.label}. ID = "c146. rendering = "#{rank." PhoneNumber1ResponseFlag eq 'F'} ">" < af:outputText value = "#{rank." PhoneNumber1}. ID = "ot130" / > < / af:column > < af:column sortProperty = "PhoneNumber1ResponseFlag." sortable = "false". headerText = "#{bindings." B.hints.PhoneNumber1ResponseFlag.label}. ID = "c80" rendered = "true" > < af:outputText value = "#{rank." PhoneNumber1ResponseFlag}. ID = "ot129" / > < / af:column > The data presented in the table for the PhoneNumber1ResponseFlag column are F. Still my condition does not work.
Well, I've finally sorted it myself by managed bean.
Here are the steps I followed:
- Wrote a new bean managed.
- Added a Boolean variable called flag and made to true when the "'PhoneNumber1ResponseFlag ' current line attribute is equal to F."
- Changing the property made column on this indicator.
Maybe you are looking for
-
I understand that in mail when you swipe to the left, an option has been archive. I only get the option delete. Is that correct. I have iPhone 6 options of bothe. Please help me understand the options available. 10.11.6 OSX Thank you
-
HP Support Assistant does not work in Windows 8.1
After the 8.1 update widows 8, HP support Assistant has stopped working. I uninstalled and reinstalled several times, and nothing changes. I checked that all the drivers are up to date. It's going to be an HP update, if so how long will they take?
-
window doesn't fit screen.
My window is smaller than my screen. How should I do?
-
install HP DeskJet 600 in Windows Vista - cannot print
original title: install HP DeskJet 600 in Windows Vista I have an old (1995) HP DeskJet 600 c which works very well on my old desktop computer. I bought a USB adapter cable, to replace my old printer cable. I am trying to connect this printer to my n
-
Port-a-thon: I forgot to sign
Dear support! I forgot to fill out the forms required for completing the last android port-a-thon event, well I sent a few apps brought the period of 36 hours. My question is: can I participate in this event and get the reward? I would appreciate if