Merging 3 select in one query
Good Day!!!
Got a little problem guys,
i got 3 tables and i need to get get the count of plate_no on each table but all table have where condition im using oracle xe 11g
here is my 3 query:
SELECT COUNT(PLATE_NO)
FROM EX_DEPOT
WHERE PLANT_ORIGIN IN ('Batangas','Teresa','Bulacan')
AND STATUS IN ('ON THE WAY TO PLANT','TRUCK IS LOADED','FOR QUEUING','QUEUING FOR DEPOT','ON THE WAY TO DEPOT'
,'ON THE WAY TO DEPOT','UNLOADING FOR DEPOT')
SELECT COUNT(PLATE_NO)
FROM EX_BULACAN
WHERE status not in ('NA as this moment','SERVED','CANCELLED')
AND PLANT_ORIGIN IN ('Batangas','Teresa','Bulacan','Norzagaray')
select count(PLATE_NO)
from BREAK
WHERE LOCATION NOT IN ('NA AT THIS MOMENT');Note: Is that possible to make that 3 query to one?
please help need that for my reports
Regards,
Mike
>
Is that possible to make that 3 query to one?
>
Since the data sources have nothing in common just UNION ALL the results together
SELECT 'EX_DEPOT' data_source, COUNT(PLATE_NO) PLATE_COUNT
FROM EX_DEPOT
WHERE PLANT_ORIGIN IN ('Batangas','Teresa','Bulacan')
AND STATUS IN ('ON THE WAY TO PLANT','TRUCK IS LOADED','FOR QUEUING','QUEUING FOR DEPOT','ON THE WAY TO DEPOT'
,'ON THE WAY TO DEPOT','UNLOADING FOR DEPOT')
UNION ALL
SELECT 'EX_BULACAN', COUNT(PLATE_NO)
FROM EX_BULACAN
WHERE status not in ('NA as this moment','SERVED','CANCELLED')
AND PLANT_ORIGIN IN ('Batangas','Teresa','Bulacan','Norzagaray')
UNION ALL
SELECT BREAK, count(PLATE_NO)
from BREAK
WHERE LOCATION NOT IN ('NA AT THIS MOMENT');The result will something like:
DATA_SOURCE PLATE_COUNT
EX_DEPOT 582
EX_BULACAN 74
BREAK 103
Similar Messages
-
Grouped and non-grouped SELECT in one query: help!
look first at: Wrong result when I use CASE on this forum. Here I wanted to get the user who created and the user who solved a problem (Lets call it Validation Error from now on (VE)).
The thing is: I already have a query who returns me lots of information about a VE.
The query in the previous thread returned me additional info about that VE (that is the creating_user and the solving_user). The 1st query is no group select, but the second is! Still, I need to combine those two in one query.
1st query:
select ve.seq,
max((case vah.action when 'C' then vah.ur_code else null end)) created,
max((case vah.action when 'S' then vah.ur_code else null end)) solved
from validation_errors ve
left outer join ver_action_histories vah
on (ve.seq = vah.ver_seq AND ve.log_date = vah.ver_log_date)
where ve.seq = 12860687
group by ve.seq;Result:
seq | created | solved
12860687 Bob Bobdont mind the "where"-clause, it is just to make the query go faster
what I do is: I join the VE with the ver_action_histories table which contains the users and what action they performed on a VE.
Now I just want to add that information to the results of an other query which also returns lots of information about a VE.
2nd query:
select ve.seq "VE seq", mh.seq "Counter seq",
ve.log_date, ve.solve_date, ve.solved Status, ve.failure_code, ve.mde_code,
mh.meter_type,
iv.mr_type, iv.mr_reason,
ih.mmr_seq
from validation_errors ve
inner join meter_histories mh
on (ve.mhy_seq = mh.seq)
left outer join index_values iv
on (ve.mhy_seq = iv.mhy_seq AND ve.log_date =iv.timestamp)
left outer join index_histories ih
on (ve.mhy_seq = ih.ive_mhy_seq)
where ve.seq = 8653936
and sysdate >= mh.start_date
and sysdate < mh.end_date;dont mind the "where" and "and"-clauses ... I hope the result of this query will simplify things ...
Result:
seq | counter seq | log_date | solved_date | status | failure_code | ...
12860687 4568 1-jan-06 2-jan-06 Solved ABCNow the actual question: Is it possible to combine those queries in one query? I just want the results of the first query (creating_user and solving_user) to be added as columns to the second result. Performance is very important. Please tell me that its possible?
Wanted Result:
seq | counter seq | log_date | solved_date | status | failure_code | created | solved | ...
12860687 4568 1-jan-06 2-jan-06 Solved ABC Bob BobIf anything I explained is unclear, please tell so I can try to explain it in an easier way.Try an in line view:
select *
from
( <your first query goes here > ) a
, ( <your second query goes here > ) b
where a.seq = b.seq -
Multiple Hierarchies in one query - selection order
Hallo experts,
can you maybe help with the following issue:
We have a query which uses two Company structure hierarchies (Hierarchy 1 & Hierarchy 2).
In the variable selection of the query, the system gives us only the Hierarchy 2 for selection.
Is there a possibility to controll what the system gives for selection? Namely that the system shows the Hierarchy 1 for selection in variable selection?
Thanks,
FazliddinHi,
If u are on BI7 u can use restrict the hierarchy with 'hierarchy 1' in 'default values' section.
Else u can write CMOD exit with i_step=1 and set the value to 'hierarchy 1' there
Hope it helps
Regards,
Rathy -
Need to re write as a one query
Hi,
I have a below two queries and i need re write as same query.I'm passing test session id's to second query as of now.In second query i have minimum 5 recods for 1 test session id.finally I'm converting rows as a column from second query based on roster_domain_name column(see the finally o/p).could you some on help.advance thanks.
1st query
SELECT DISTINCT a.test_session_id test_session_id, address,
TO_CHAR (birth_date, 'yyyy-MM-dd') AS birth_date,
branching_profile_name, city, email, exnum, first_name,
home_phone, institution_id_display, last_name, middle_name,
site_id_display, state_name, student_id,
TO_CHAR (test_session_date,
'yyyy-MM-dd') AS test_session_date, zip
FROM vuestudenttestsessioninfo a, test_session_detail b
WHERE EXISTS (
SELECT td.test_detail_id
FROM test_detail td
WHERE domain_map_id IS NOT NULL
AND b.test_detail_id = td.test_detail_id
AND domain_map_id IN (27604,27605,27606,27607))
AND site_id IN ('8904')
AND TRUNC (test_session_date) BETWEEN TO_DATE ('11/24/2009',
'MM/DD/YYYY'
AND TO_DATE ('12/4/2009',
'MM/DD/YYYY'
AND a.test_session_status_id IN (3, 4)
AND a.test_session_id = b.test_session_id
ORDER BY address1st query o/p like below
TEST_SESSION_ID ADDRESS BIRTH_DATE BRANCHING_PROFILE_NAME CITY EMAIL EXNUM FIRST_NAME HOME_PHONE INSTITUTION_ID_DISPLAY LAST_NAME MIDDLE_NAME SITE_ID_DISPLAY STATE_NAME STUDENT_ID TEST_SESSION_DATE ZIP
SELECT a.test_session_id,c.roster_domain_name,to_char(a.score),a.sem FROM
test_session_detail a,test_session b ,test_detail c
WHERE a.test_session_id = b.test_session_id
AND c.test_detail_id = a.test_detail_id
AND exists (
select td.test_detail_id
from test_detail td
where domain_map_id is not null
and c.test_detail_id =td.test_detail_id
and domain_map_id in('303','306','305','304'))
AND b.test_session_id in (getting session ids from 1st query)
AND domain_group_id NOT IN (
SELECT domain_group_id
FROM test_session_detail a,test_session b
WHERE a.test_session_id = b.test_session_id
AND a.domain_group_id is not null
AND b.test_session_status_id = 4
AND a.test_session_status_id <> 3
AND b.test_session_id IN (getting session ids from 1st query))
2nd query o/p
TEST_SESSION_ID ROSTER_DOMAIN_NAME TO_CHAR(A.SCORE) SEM
final o/p
Address Birth Date Branching Profile City Email Exnum First Name Home Phone Inst ID Last Name Middle Initial Site ID State/ Province Student ID Test Date Zip Code AR - Integers and Fractions AR - Decimal Numbers AR - Percent AR - Estim, Ordering, Numb. Sense AR - Word ProblemsHi ,
Version *10.1.0.2.0*
Business rule is:
I have two scenarios 1) can use first query getting result
2) can use both queries getting result.
In second scenario i'm facing problem with regarding taking more time due to executing two queries one after one.
because i'm getting test session id's from first query executing and displaying results from both quires .Now i have thought to merge both queries as a one query.I think it's possible with in line view quires(2nd query).Pls help
And DDL part i'm using 1 view and reaming tables.here those scripts.
VIEW vuestudenttestsessioninfo
Name Null? Type
STUDENT_ID NOT NULL VARCHAR2(50)
FIRST_NAME NOT NULL VARCHAR2(50)
MIDDLE_NAME VARCHAR2(50)
LAST_NAME NOT NULL VARCHAR2(50)
ADDRESS VARCHAR2(201)
CITY VARCHAR2(30)
STATE_PROVINCE_COUNTRY VARCHAR2(30)
ZIP VARCHAR2(20)
EMAIL VARCHAR2(100)
HOME_PHONE VARCHAR2(20)
CELL_PHONE VARCHAR2(20)
BIRTH_DATE DATE
STUDENT_ID_PK NOT NULL NUMBER
EXNUM NOT NULL NUMBER(9,)
TEST_SESSION_DATE DATE
COMPLETION_DATE DATE
TEST_SESSION_ID NOT NULL NUMBER(9,)
INSTITUTION_ID NOT NULL NUMBER
SITE_ID NOT NULL NUMBER
BRANCHING_PROFILE_ID NOT NULL NUMBER(10,)
TEST_SESSION_STATUS_ID NOT NULL NUMBER(10,)
INSTITUTION_ID_DISPLAY VARCHAR2(10)
SITE_ID_DISPLAY VARCHAR2(10)
STATE_NAME VARCHAR2(30)
BRANCHING_PROFILE_NAME VARCHAR2(100)
SITE_NAME NOT NULL VARCHAR2(200)
ADDRESS_2 VARCHAR2(100)
ADDRESS_1 VARCHAR2(100)
SQL> desc test_session
Name Null? Type
TEST_SESSION_ID NOT NULL NUMBER(9)
INSTITUTION_ID NOT NULL NUMBER
STUDENT_ID_PK NOT NULL NUMBER(9)
BRANCHING_PROFILE_ID NOT NULL NUMBER(10)
TEST_SESSION_STATUS_ID NOT NULL NUMBER(10)
TEST_SESSION_DATE DATE
ACCESSED_TIMES NUMBER(9)
COMPLETION_DATE DATE
DURATION NUMBER(10)
CREATED_ON DATE
MODIFIED_ON DATE
CREATED_BY NUMBER
MODIFIED_BY NUMBER
IS_RESUMED CHAR(1)
SQL> desc test_session_detail
Name Null? Type
TEST_SESSION_DETAIL_ID NOT NULL NUMBER(9)
TEST_SESSION_ID NOT NULL NUMBER(9)
TEST_DETAIL_ID NOT NULL NUMBER(10)
TEST_SESSION_STATUS_ID NUMBER
THETA NUMBER
SCORE NUMBER
PERCENTILE NUMBER
SEM NUMBER
TEST_START_DATE DATE
TEST_END_DATE DATE
TEST_DURATION NUMBER
CREATED_ON DATE
MODIFIED_ON DATE
CREATED_BY NUMBER
MODIFIED_BY NUMBER
TEST_SEED VARCHAR2(15)
TEST_ALIAS VARCHAR2(30)
COMPANION_FORM CHAR(1)
DURATION_START_DATE TIMESTAMP(6)
DURATION_END_DATE TIMESTAMP(6)
DOMAIN_GROUP_ID NUMBER
TIMER_LIMIT VARCHAR2(100)
SQL> desc test_detail
Name Null? Type
TEST_DETAIL_ID NOT NULL NUMBER(10)
TEST_TYPE_ID NOT NULL NUMBER(10)
OPERATIONAL_POOL_ID NUMBER(10)
FIELD_TEST_POOL_ID NUMBER(10)
INSTITUTION_ID NOT NULL NUMBER
TEST_NAME NOT NULL VARCHAR2(500)
TEST_ALIAS VARCHAR2(30)
DESCRIPTION VARCHAR2(100)
OPERATIONAL_TEST_LENGTH NUMBER
ACTIVE_STATUS CHAR(1)
DELETE_STATUS CHAR(1)
FIELD_TEST_ITEM VARCHAR2(1)
FIELD_TEST_LENGTH NUMBER
IS_DIR_SAMPLE CHAR(1)
DIR_SAMPLE_PATH VARCHAR2(1000)
CREATED_ON DATE
MODIFIED_ON DATE
CREATED_BY NUMBER
MODIFIED_BY NUMBER
FORM_NAME VARCHAR2(10)
DOMAIN_MAP_ID NUMBER(9)
DOMAIN_SEQUENCE NUMBER(9)
ROSTER_DOMAIN_NAME VARCHAR2(100) -
Merging rows into one row but into SEPARATE Columns
Hello Gurus,
I have searched alot on OTN and many other places, but no where I could get the solution of how can we merge rows into one row but separate column. For example
Consider the below scenario
"DEPARTMENT", "EMP","NAME","SUBJECT"
"Electronics","1","Sam","LIC"
"Electronics","2","Pam","VLSI"
"Electronics","3","Tom","C"
"Mech","1","Abu","Thermo"
"Mech","4","Lina","Machines"Now, I need the output like
Based on Department as Group By Clause
"DEPARTMENT", "EMP1","NAME1","SUBJECT1","EMP2","NAME2","SUBJECT2","EMP3","NAME3","SUBJECT3"
"Electronics","1","Sam","LIC","2","Pam","VLSI","3","Tom","C"
"Mech","1","Abu","Thermo","4","Lina","Machines"
The row data to be loaded into separate columns. Name of the column is not an issue... can be anythingIn all the forums which I went through I could find them loading into a single column, but not into respective separate columns.
Any help would be much appreciated.
Thanks848265 wrote:
Frank,
I saw your name nearly n number of times, as I went through many forums today... And the link which you have just posted, I went through it today afternoon.
Could you please explain this bit taken from your dynamic pivot post.
SELECT DISTINCT
', COUNT (CASE WHEN job = '''
|| job
|| ''' ' AS txt1
, 'THEN 1 END) AS '
|| job
|| '_CNT' AS txt2
FROM scott.emp
ORDER BY txt1;Many Thanks.You only need that when you need column aliases based on the actual data (and you explicitly said you don't need that) or when can't put an upper bound on the number of columns to be displayed. If that doesn't apply to this problem, then don't use any kind of dynamic SQL (like the code above); it makes the job much more difficult, less efficient and less robust.
Here's what the code above is doing.
If you were hard-coding a query that showed the number of people in each job, and you knew that the possible jobs were 'ANALYST', 'CLERK' and 'MANAGER', then you might hard-code a query like this:
SELECT deptno
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk
, COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS manager
FROM scott.emp
GROUP BY deptno
;If the jobs had different names, or if there were not 3 different jobs, then you would have to change the lines in the SELECT clause that start with ", COUNT ( CASE ...".
The code you posted is from an example of dynamic SQL, where you first run a Preliminary Query . (What you posted above is, in fact, the complete preliminary query.) The output of that preliminary query is exactly the variable part of the real query, such as:
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk
, COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS managerYou then use this output as part of your main query. In other words, you can write something today that will generate exacrly as many columns as you need next year, with names from the data as it is next year. How? because you're not writing the full query today. The variable part will be written by the preliminary query when it runs next year. -
Can you check for data in one table or another but not both in one query?
I have a situation where I need to link two tables together but the data may be in another (archive) table or different records are in both but I want the latest record from either table:
ACCOUNT
AccountID Name
123 John Doe
124 Jane Donaldson
125 Harold Douglas
MARKETER_ACCOUNT
Key AccountID Marketer StartDate EndDate
1001 123 10526 8/3/2008 9/27/2009
1017 123 10987 9/28/2009 12/31/4712 (high date ~ which means currently with this marketer)
1023 124 10541 12/03/2010 12/31/4712
ARCHIVE
Key AccountID Marketer StartDate EndDate
1015 124 10526 8/3/2008 12/02/2010
1033 125 10987 01/01/2011 01/31/2012
So my query needs to return the following:
123 John Doe 10526 8/3/2008 9/27/2009
124 Jane Donaldson 10541 12/03/2010 12/31/4712 (this is the later of the two records for this account between archive and marketer_account tables)
125 Harold Douglas 10987 01/01/2011 01/31/2012 (he is only in archive, so get this record)
I'm unsure how to proceed in one query. Note that I am reading in possibly multiple accounts at a time and returning a collection back to .net
open CURSOR_ACCT
select AccountID
from
ACCOUNT A,
MARKETER_ACCOUNT M,
ARCHIVE R
where A.AccountID = nvl((select max(M.EndDate) from Marketer_account M2
where M2.AccountID = A.AccountID),
(select max(R.EndDate) from Archive R2
where R2.AccountID = A.AccountID)
and upper(A.Name) like parameter || '%'
<can you do a NVL like this? probably not... I want to be able to get the MAX record for that account off the MarketerACcount table OR the max record for that account off the Archive table, but not both>
(parameter could be "DO", so I return all names starting with DO...)if I understand your description I would assume that for John Dow we would expect the second row from marketer_account ("high date ~ which means currently with this marketer"). Here is a solution with analytic functions:
drop table account;
drop table marketer_account;
drop table marketer_account_archive;
create table account (
id number
, name varchar2(20)
insert into account values (123, 'John Doe');
insert into account values (124, 'Jane Donaldson');
insert into account values (125, 'Harold Douglas');
create table marketer_account (
key number
, AccountId number
, MktKey number
, FromDt date
, ToDate date
insert into marketer_account values (1001, 123, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('27.09.2009', 'dd.mm.yyyy'));
insert into marketer_account values (1017, 123, 10987, to_date('28.09.2009', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
insert into marketer_account values (1023, 124, 10541, to_date('03.12.2010', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
create table marketer_account_archive (
key number
, AccountId number
, MktKey number
, FromDt date
, ToDate date
insert into marketer_account_archive values (1015, 124, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('02.12.2010', 'dd.mm.yyyy'));
insert into marketer_account_archive values (1033, 125, 10987, to_date('01.01.2011', 'dd.mm.yyyy'), to_date('31.01.2012', 'dd.mm.yyyy'));
select key, AccountId, MktKey, FromDt, ToDate
, max(FromDt) over(partition by AccountId) max_FromDt
from marketer_account
union all
select key, AccountId, MktKey, FromDt, ToDate
, max(FromDt) over(partition by AccountId) max_FromDt
from marketer_account_archive;
with
basedata as (
select key, AccountId, MktKey, FromDt, ToDate
from marketer_account
union all
select key, AccountId, MktKey, FromDt, ToDate
from marketer_account_archive
basedata_with_max_intervals as (
select key, AccountId, MktKey, FromDt, ToDate
, row_number() over(partition by AccountId order by FromDt desc) FromDt_Rank
from basedata
filtered_basedata as (
select key, AccountId, MktKey, FromDt, ToDate from basedata_with_max_intervals where FromDt_Rank = 1
select a.id
, a.name
, b.MktKey
, b.FromDt
, b.ToDate
from account a
join filtered_basedata b
on (a.id = b.AccountId)
ID NAME MKTKEY FROMDT TODATE
123 John Doe 10987 28.09.2009 31.12.4712
124 Jane Donaldson 10541 03.12.2010 31.12.4712
125 Harold Douglas 10987 01.01.2011 31.01.2012
If your tables are big it could be necessary to do the filtering (according to your condition) in an early step (the first CTE).
Regards
Martin -
Convert data link between one query's group and another querys group to SQL
Hi
I have a report where there are 2 query Groups. These 2 query groups r linked by data link. How do i combine these queries to One query so i can use it as a SQL query.
ThanksHi,
Assume that we have two queries Q1 and Q2 and the common column between the two queries is "comn".
Now we can convert the datalink into SQL as follows:-
SELECT *
FROM
(Query for Q1)a,
(Query for Q2)b
WHERE a.comn=b.comn(+)
Note: "a" and "b" are alias names for Q1 and Q2. -
How do I merge photos from one album to another on my iPad
How do I merge photos from one album to another. How do I delete, remove albums.
If they are albums that you've synced from your computer then they are removed by re-connecting to your computer's iTunes, de-selecting them on the Photos tab, and re-syncing - albums and photos that you've synced can't be deleted (and albums can't be merged) directly on the iPad.
If they are albums that you've created directly on the iPad then you should be able to delete them on the iPad via the Edit button at the top left of the album selection screen. You can also copy more photos into (via the Edit button when within an album), and delete photos from, those albums. -
Retrieving spatial and non spatial data in one query
Hello. I am having slight difficulties using JDBC to retrieve both spatial and non spatial data in the same query. The following is code from a sample program of mine that retrives spatial data from spatial tables.
(In spatialquery geom is a geometry column and city is simply the name of the city):
try
Geometry geom = null;
String database = "jdbc:oracle:thin:@" + m_host + ":" + m_port + ":" + m_sid;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = (OracleConnection)DriverManager.getConnection(database, sUsername, sPassword);
GeometryAdapter sdoAdapter =
OraSpatialManager.getGeometryAdapter("SDO", "8.1.7", STRUCT.class, null, null, con);
String spatialquery = "SELECT a1.geom, a1.city \n" +
"FROM cities a1";
Statement stmt = con.createStatement();
OracleResultSet rs = (OracleResultSet) stmt.executeQuery(spatialquery);
int i = 0;
int noOfFeatures = 2;
while (rs.next())
for(i = 1; i <= noOfFeatures; i++)
STRUCT dbObject = (STRUCT)rs.getObject(i);
try
geom = sdoAdapter.importGeometry(dbObject);
catch(GeometryInputTypeNotSupportedException e)
System.out.println("Input Type not supported");
catch(InvalidGeometryException e)
System.out.println("Invalid geometry");
System.out.println(geom);
}//end while loop
This retrieves the sptial data fine, however when I attempt to retreive the non-spatial data I keep getting a "ClassCastException" error. I understand it is something to do with "STRUCT dbObject = (STRUCT)rs.getObject(i);" line. Can anyone tell me how to retrieve both spatial and non-spatial data in the one query using JDBC. I have tried nearly everything at this stage. Cheers joeTheresa A Radke
Posts: 20
OTN Member Since: Jul, 2001
retrieving spatial and non spatial in same query. May 23, 2003 12:02 AM
retrieving spatial and non spatial in same query. -
Checking and inserting in one query
Hi,
I want to check for the existance of a record in a table. If the record is not present then I would like to insert the data.
I have written a query for this but it is giving me error as ORA-01427: single-row subquery returns more than one row which is true.
Please help me to rewrite this query. I do not want any procedures etc to apply. Just one query.
insert into mif_type_temp (FLD_TYPE, FLD_VALUE) values ('SIN', (select b.empname from
*(select empname from testing tes where not exists*
*(select 1 from mif_type_temp where tes.empname = FLD_VALUE))b))*
ThanksThe VALUES clause can only accept scalar values. Maybe you could try something like this?
INSERT INTO mif_type_temp
( fld_type
, fld_value
SELECT 'SIN'
, empname
FROM testing test
WHERE NOT EXISTS (
SELECT 1
FROM mif_type_temp mtt
WHERE test.empname = mtt.fld_value
; -
Update multiple UDF from one query generator
Hi All,
I have Form1 with multiple UDF1 which have been key in by users
And another Form2 with multiple UDF2 which exactly same with Form1 UDF1
Is there a way that I can copy multiple UDF at Form2UDF2 from Form1UDF1 instead of creating query for each individual UDF, where in query generator I can select more the one column but only first column will be insert to the single UDF.
ThanksHi Firos,
I mean I have 7UDF in the Payment Form where the information to this UDF are come from 7UDF in the invoice form which already created previously so I would like to copy those UDF from invoice to UDF in payment by using single query to capture all the UDF information by doing:
SELECT T0.[DocNum], T0.[UDF1], T0.[UDF2], T0.[UDF3], T0.[UDF4], T0.[UDF5], T0.[UDF6], T0.[UDF7]
FROM OINV T0 WHERE T0.[CardCode] = $[ORCT.CardCode]
From above query can I pass the result directly to UDF in Payment Form? or I need to create one query for each individual UDF.
Thanks -
When to use SELECT and END SELECT in the query.
hi all,
When to use SELECT and END SELECT in the query.
regads,
Venkata Suresh Penke.Hi Suresh..
When do we need to use SELECT .. ENDSELECT
Usually we will never use SELECT .. ENDSELECT as it gives very poor performance.
But whenever we read a single Record we will use it as an alternative for SELECT SINGLE in some scenarios.
Eg: When the Full primary key is not specified in the WHERE clause.
SELECT * FROM MARC INTO WA_MARC UP TO 1 ROWS WHERE MATNR = P_MATNR.
ENDSELECT.
And other scenario is when we perform AGGREGATE OPERATIONS.when the Result is only one row.
SELECT SUM( LABST ) FROM MARD INTO V_LABST UP TO 1 ROWS
WHERE MATNR = P_MATNR.
ENDSELECT.
Note: In The Above scenario we cannot use SELECT SINGLE..
<b>REWARD IF HELPFUL.</b> -
Output of One Query is input to other Query??
Hi All,
How to make output of one query as input to other Query and what are the points to be takeb care of to do it?
regards,
murali.
Message was edited by: MuraliHallo
You got a second query where you also have 0date. Based on the selection on the second query, you get some value for 0date. this values are then passed in background to the first query which will show you the output based on the input date of the first query. You can also have othe variable in the query.
http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
I hope everything is fine.
Mike -
Problem with 0FIGL_VC1 when use constant selection in the query
Please kindly help me. I have this problem for 2 weeks already.
When I create a query from virtual cube 0FIGL_VC1 (balance sheets / p&l statements), if I use constant selection in any of key figure, my report could not display financial statment correctly.
My report layout
Columns : key figures (including 0FIGL_VC1_CK001)
Rows: 0GLACCEXT (financial statement item) << as hierarchy
Initially, the query is processed correctly.
However, based on the requirement from my customer, I really have to use "constant selection" for some of my columns. Whenever I do so, the query display incorrectly. (Some nodes of financial statement item just disappear. (it seem like all contra item will disappear.)
Please help!If I dont use constant selection in the query, data are display correctly.
But If I use constant selection in the query, some financial statement item dont display any value
Example :
Financial statement item(Display in hier) Period1 Total Period1(Constant selection)
A 10 60
B 20 60
C 30 60
D 0 60
- Financial statement item "D" has some value.
- Financial statement item "D" is in the hierarchy,one gl account has been assigned to more than one group differentiated by debit/credit indicator.
Please help!! -
Different results for one query
Hi,
Today i got a very surprising issue with SQL 2008, my one team member inform that a single query is resulting two different data set from two diff-diff SSMS's query windows.
Query is like this,
Select * from table1 where trandate between '2014-08-02 00:00:00.000' and '2014-08-03 23:59:59.999' and status='S'
in one query window its showing 295 records while on same desktop in second query window its showing 602 records.
Please let me know where is problem. [:)]
Thanking you.
Virendra Yaduvanshi
Principal DBA,
MCTS, MCITP
http://wikidba.wordpress.com
Virendra Yaduvanshi http://wikidba.wordpress.com/Are updates occurring that are modifying the data or do you get the same results in each window multiple times?
One thing to do is look at the actual execution plans and see if they are identical.
If parallelism is involved, try disabling it and see if the results change (I've seen some twitchy things happen with it)
If all of that checks out it may be some implicit conversion is happing to the date or there is a case sensitivity issue with the 'S'
Maybe you are looking for
-
Deploying web dynpro application into portal
hi I have created a simple example in webdynpro in Netweaver developer studio, and I have deployed it into the portal whose version is EP6 SP9. where can I see that deployed webdynpro application(in my case it is WebDynpro_Basics.ear) in the portal.
-
Stitching/mergigng of xdps using document builder when fragments have been used in xdps.
Hi, I am trying to merge xdps using document builder in LiveCycle workbench. Basiclly I am using the option "Dynamic stitching" in document builder to merge more then one xdps. So I am able to do it when my xdps are not having any fragments. But I am
-
Problem in the Procedure GET_MATCHING
THE PROCEDURE JOB : GET compare BETWEEN ANY WORD IN TABLE dynamic for Each character but the loop not stop when i run the procedure please help me i have frustration ...thanks for all team support BODY Procedure : CREATE OR REPLACE PROCEDURE APPS.get
-
There are 3 pending updates for my desktop 400-335d recommended by HP support assistant. When I tried to udpate, it cannot be downloaded at all. Thanks for your help!
-
While configuring omwb its asking for plugins. not able to find plugins
Hi after registring it is asking for plugins. failed to search for SQL_SERVER2K.Jar file. Can you help me when can i find the file to down load. or otherwise. Thanks in advance Bhaskar [email protected]