Need to write a query for extractions
How can I extract the following data from Oracle:
1. Segment1 and description from mtl_system_items_b
2. Onhand quantity that is orderable (Not under the WIP manufacturing or PO)
3. Onhand quantity that not orderable (That is under WIP manufacturing or PO)
4. Retail Price of these items.
There is only one organization_id =21 needs to be considered. This extract needs to be a daily kind of an extract. If you can help me in writing the query for all the fields above with proper joins, I'll really appreciate.
Thanks & Regards
KM
Hi,
Primary_uom_code and Primary_transaction_quantity shows the items quantity on the basis of primary code
whereas Secondary_uom_code and secondary_transction_quantity shows the items quantity on different code.
e.g. suppose you have an item Pen opened on the primary code as Each. 1 Each = 1 Pen.
You have a conversion set as 10 Each = 1 Pkt.
At the time of transaction if you selects as 1 Pkt,
The primary_transaction_quantity will show 10 Each where as the secondary_transaction_quantity will show 1Pkt.
Now as the transaction has done as Pkt the column Transaction_quantity will display 10Pkt.
If you have done this transaction on the primary code as 10 Each.
The primary_transaction_quantity would show the same 10 Each but the Secondary_transaction_quantity will by
null and the transaction_quantity will be 10 Each.
Hope this will clarify the issue.
2) why you want to join these tables
How can I join the following tables: qp_list_lines and mtl_system_items_b? I want to find the price of each
item. I tried using inventory_item_id but it does not work as inventory_item_id can be null in qp_list_lines table.i have not been able to find any thing in table qp_list_lines.
Similar Messages
-
Need to write SQL query for hierarchy
Hi Guys,
I need help to write a query for the below scenario.
I have one organization, under that I have many branches. when i provide input to query on last branch, i need to display all parents of that branch like below
Organization ---parent
branch 1 ---child
branch11
branch 12
branch 2 ---child
branch 21
branch 3 ----child
branch 31
branch 32
branch 33
here, when i provide input as branch 3, then I need to fetch results branch 2, branch 1 till organization.
can any one help me on this.
Thanks in advance!
Regards,
LKRHi,
Is this the same question as
https://community.oracle.com/thread/2616828
Please don't post the same question over and over. Mark this thread as "Answered" right away, and continue in the other thread (if necessary; the other thread has answers.) -
Write a query for which has its field name as input parameter
Hi All,
I need to write a query for SSRS report. StartDate, EndDate and ChangedField are the input parameters.
Let's consider that we are taking employee details. The table contains lot of fields like emp name,add1,add2,city,state,country,designation,rank etc. We have almost 30 fields are there. These field name are coming as input parameter "ChangedField"
. I need to show the records which belong to the start date and end date also data change for the field which is given in the input parameter "ChangedField". That meand If I give ChangedField="city", we need to check for data which
has been updated with new City name in the given time period.
Please suggest.
Regards,
JulieHi Julie,
Per my understanding that you have many fields in the table to be displayed in the report, some of the fields will always show and others should be hide and show based on the selection of the parameters which include the columns names, right?
By default, we can't display columns dynamically in the report automatically without insert this column in the report before. So, in your scenario, I will suggest you to add all the columns in the reports first and then add show/hide expression on
the column visibility based on the selection of the parameter "ChangedField", when some of the fields selectted they will be display, otherwise they will be hidden. For the fields which you want to be always displayed will not need to add the expression
in the column visibility.
Details steps about how to acheive this, please referencet to the article below:
Displaying Dynamic Columns in SSRS Report
If you still have any problem, please feel free to ask.
Regards,
Vicky Liu
Vicky Liu
TechNet Community Support -
Need to write a query while configuring Database Adapter
Hi,
I am working in BPEL.i need to write a query while configuring the DB adapter. i need to query a table which contains five rows each row containing 7 columns. my query should be like if i give the first column name(for eg:Title) it should return the complete row(i.e all the 7 columns in a row).
So after deploying during testing when i give the Column name(Title) in the BPEL console it should return the row.
How to write a query such tht if i give any title name in the five rows it should return the respective row
please help me out.
Regards,
MohamedHi,
I got the answer for this.its working fine now.
the query is: select TITLE,..... from movie where (TITLE =#title);
The second "title" will be the one which i am going to give in bpel console
so it wil check with the "TITLE" in the table and execute the query.
Regards,
Mohamed -
Need help writing a query for following scenario
Hi all, I need some help writing a query for the following case:
One Table : My_Table
Row Count: App 5000
Columns of Interest: AA and BB
Scenario: AA contains some names of which BB contains the corresponding ID. Some
names are appearing more than once with different IDs. For example,
AA BB
Dummy 10
Me 20
Me 30
Me 40
You 70
Me 50
Output needed: I need to write a query that will display only all the repeating names with their corresponding IDs excluding all other records.
I would appreciate any input. ThanksIs it possible to have a records with the same values for AA and BB? Are you interested in these rows or do you only care about rows with the same value of AA and different BB?
With a slight modification of a previous posting you can only select those rows that have distinct values of BB for the same value of AA
WITH t AS (
SELECT 'me' aa, 10 bb FROM dual
UNION ALL
SELECT 'me' aa, 20 bb FROM dual
UNION ALL
SELECT 'you' aa, 30 bb FROM dual
UNION ALL
SELECT 'you' aa, 30 bb FROM dual
SELECT DISTINCT aa, bb
FROM (SELECT aa, bb, COUNT(DISTINCT bb) OVER(PARTITION BY aa) cnt FROM t)
WHERE cnt > 1; -
Write a query for finding STDDEV for OLAP Cube
Can anybody post a sample query which will find the standard deviation of sales for each month in the sample GLOBAL OLAP schema for Oracle 11g.
The OLAP option automatically generates a set of relational views on cubes, dimensions, and hierarchies in Oracle 11g. So how can i write a query for finding the Standard deviation on these views.The easiest way to do this is to do this directly within the AW using a custom calculated measure. In AWM11g you can use the 11g custom measure wrapper to execute the STDDEV function:
olap_dml_expression('function',data type)
For example
olap_dml_expression('STDDEV(cube_name, time_dimension_name)',number)
You can then simply expose this calculated measure as another column in your SQL View and then there is no need to use the SQL equivalent. This means the calculation is performed inside the AW (which is as close to the source data as you can get) ensuring performance of the whole query remains high.
If necessary you can take this a step further, if required, and wrap the STDDEV calculation within an OLAP DML program that would allow you to manipulate the status of time within the calculation. For example, you may want the STDDEV calc to only take into account the last 12 time periods rather than all time periods currently in status.
Hope this helps
Keith Laker
Oracle EMEA Consulting
OLAP Blog: http://oracleOLAP.blogspot.com/
OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
DM Blog: http://oracledmt.blogspot.com/
OWB Blog : http://blogs.oracle.com/warehousebuilder/
OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html -
I need to add a single field from with_item table . need to write select query with reference to company code , account doc no , fiscal year
Hi Arun ,
Can you explain little bit more ??
what is account doc no?
what are the transactions should be displayed in your output??
-Rajesh N -
How to write sql query for counting pairs from below table??
Below is my SQL table structure.
user_id | Name | join_side | left_leg | right_leg | Parent_id
100001 Tinku Left 100002 100003 0
100002 Harish Left 100004 100005 100001
100003 Gorav Right 100006 100007 100001
100004 Prince Left 100008 NULL 100002
100005 Ajay Right NULL NULL 100002
100006 Simran Left NULL NULL 100003
100007 Raman Right NULL NULL 100003
100008 Vijay Left NULL NULL 100004
It is a binary table structure.. Every user has to add two per id under him, one is left_leg and second is right_leg... Parent_id is under which user current user is added.. Hope you will be understand..
I have to write sql query for counting pairs under id "100001". i know there will be important role of parent_id for counting pairs. * what is pair( suppose if any user contains both left_leg and right_leg id, then it is called pair.)
I know there are three pairs under id "100001" :-
1. 100002 and 100003
2. 100004 and 100005
3. 100006 and 100007
100008 will not be counted as pair because it does not have right leg..
But i dont know how to write sql query for this... Any help will be appreciated... This is my college project... And tommorow is the last date of submission.... Hope anyone will help me...
Suppose i have to count pair for id '100002'. Then there is only one pair under id '100002'. i.e 100004 and 100005Sounds like this to me
DECLARE @ID int
SET @ID = 100001--your passed value
SELECT left_leg,right_leg
FROM table
WHERE (user_id = @ID
OR parent_id = @ID)
AND left_leg IS NOT NULL
AND right_leg IS NOT NULL
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to write selection Query for the following requirment.
Hi All,
I am new to ABAP, I need a help ,
I need to select all plants(WERKS) from MARC at Plant/Material level,
then I need to take all sales organozation(VKORG) from T001w,
then I need the company code(BUKRS) from TVKO based on VKORG,
then I need the currency key(WAERS) from T001 based on BUKRS,
Can any one help me in writing selection Query for the same?
Thanks All,
Debrup.Hi,
Its easy for you if you learn SELECT with JOIN to complete your task. So SEARCH the forum with SELECT statement and you will get a lot of examples using which you can write your own.
If you struck up anywhere revert back.
Regards
Karthik D -
How to write select query for this
Hi,
I had a html form and in the for i had drop down box and it needs to select multiple values from the drop down box. When i select multiple values then i have to write the SQL select statement query .
When i try to write the select statement and trying to run i am getting error.
select * from Table
where emo_no = '1,2,3'
this is how i write query please suggest me how to write query for selecting multiple values from the drop down box.
Thanksselect * from Table
where emo_no in ( 1,2,3)
for integer values
select * from Table
where emo_no in ('1','2','3')
for characters
If we talk about large scale applications that may have millions of records, I would suggest this.
declare @t table (v int)
insert into t (v) values (1)
insert into t (v) valves (2)
insert into t (v) values (3)
select *
from table
inner join @t t on table.emo_no = t.v
Using "in" for a where clause is not so bad for filtering on a few values, but if you are filtering a lot of rows and a lot of values (emo_no) the performance degrades quickly for some reasons beyond the scope of this.
This is just one solution, I'll through this out as well, instead of an in memory (@t) table, doing a disk based temp table (#t) and creating an index on the column "v".
create table #t (v int)
insert into #t (v) values (1)
insert into #t (v) valves (2)
insert into #t (v) values (3)
create index ix_t on #t (v)
select *
from table
inner join #t t on table.emo_no = t.v
drop table #t
Pardon any syntax errors and careful using a drop statement.
Sometimes in memory tables work better than disk temp tables, it takes some testing and trial and error depending on your datasets to determine the best solution.
Probably too much info ;-)
Byron Mann
[email protected]
[email protected]
Software Architect
hosting.com | hostmysite.com
http://www.hostmysite.com/?utm_source=bb -
Need helping in writing query for finding percentage of duration
Can any one please help in writing query for this.
The table is like this :-
ID Region Month Duration
I1 R1 Jan 80
I2 R2 Jan 70
I3 R1 Jan 70
I4 R3 Jan 40
I5 R1 Feb 80
I6 R2 Feb 30
I7 R3 Mar 100
I want to write a query to find
% of duration for each and every region against each and every month.
Please help in solving this query. I am in urgent need of this.
Thanks in advance.I also have to do in MS Access 2003You also have to ask into an other forum since here it's an Oracle forum, to try to find Oracle solution.
Nicolas. -
How to write sql query for below example.
Hi,
I have requirement.
There are number of rows and I need the result through query as follows.Please help me to proved sql query for below mentioned requirement.
example: table TEST.
COLA COLB COLC COLD
MANAGER 5 NULL null
SR.MANAGE 6 3 NULL
VP 5 5 4
I have to write the sql query if COLA IS MANAGER THEN CONSIDER MANGER RECORD,AND IF ANY COLUMN FILED IS NULL FOR MANGER THEN CONSIDER COLA IS SR.MANGER, AND IF ANY COLUMN FILED IS NULL FOR SR,MANGER THEN CONSIDER VP records.
I need output as below.
COLB COLC COLD
5(MANGER) 3(sr.manger) 5(vp)
Please provide the for above mentioned output.
Thanks<<if COLA IS MANAGER THEN CONSIDER MANGER RECORD>>
What does this sentence means? COLA does not cnatin a single record but the number of records with diffrent values.
Regards
Arun -
How to write sql query for below mentioned eaxmple.
Hi,
I have requirement.
There are number of rows and I need the result through query as follows.Please help me to proved sql query for below mentioned requirement.
example: table TEST.
COLA COLB COLC COLD COLE COLF MANAGER 5 NULL NULL 3 NULL
SR.MANAGER 6 3 NULL NULL NULL
VP 5 5 4 5 5
I have to write the sql query if COLA IS MANAGER THEN CONSIDER MANGER RECORD,AND IF ANY COLUMN FILED IS NULL FOR MANGER THEN CONSIDER COLA IS SR.MANGER, AND IF ANY COLUMN FILED IS NULL FOR SR,MANGER THEN CONSIDER VP records.
I need output as below.
COLB COLC COLD COLE COLF
5(manager) 3(sr.manger) 4(vp) 3(manger) 3(vp)
Please provide the for above mentioned output.
ThanksDuplicate thread. please view the answer posted in your first thread.
how to write sql query.
And, please don't post any duplicate thread.
Regards.
Satyaki De. -
How to write a query for AFTER DATE
Hello Experts,
I’m new to SQL and stuck on a query. How would you write SQL Code for the following query:
The HR Department wants to determine the names of all employees who were hired after Davies:
Thanks in advance.Hello,
You need to change to the table name you have in your schema and in this case its "employees". Don't hard code date in where clause you might have different requirement later ;)
SELECT *
FROM employees
WHERE hire_date > (SELECT hire_date
FROM employees
WHERE name = 'Davies');Regards -
How to write a query for the following issue
Hello,
I would like to write a query to display the result in the following format
Item
Categort1
Categort2
Categort3
Categort4
Categort5
Categort6
Min
Max
Avg
Min
Max
Avg
Min
Max
Avg
Min
Max
Avg
Min
Max
Avg
Min
Max
Avg
01
02
03
04
For every item for the category i need to find Min,Max and Avg from the Value column
Table structure is as follows
ID
Item Id
Item
Category
value
1
01
A
Categort1
1
2
01
A
Categort1
2
3
01
A
Categort1
3
4
02
B
Categort2
7
5
02
B
Categort2
8
6
03
C
Categort3
6
7
04
D
Categort4
12
8
04
D
Categort4
14SELECT ItemID,
MIN(CASE WHEN Category = 'Categort1' THEN value END) AS Min_category1,
MAX(CASE WHEN Category = 'Categort1' THEN value END) AS Max_category1,
AVG(CASE WHEN Category = 'Categort1' THEN value END) AS Avg_category1,
MIN(CASE WHEN Category = 'Categort2' THEN value END) AS Min_category2,
MAX(CASE WHEN Category = 'Categort2' THEN value END) AS Max_category2,
AVG(CASE WHEN Category = 'Categort2' THEN value END) AS Avg_category2,
MIN(CASE WHEN Category = 'Categort6' THEN value END) AS Min_category6,
MAX(CASE WHEN Category = 'Categort6' THEN value END) AS Max_category6,
AVG(CASE WHEN Category = 'Categort6' THEN value END) AS Avg_category6
FROM Table
GROUP BY ItemID
The format can be achieved using tools like SSRS
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Maybe you are looking for
-
The pass 4 days now my iTunes Store is not responding, when I reload it all that comes up is a blank white page that says iTunes Store. Help please!!!! Cannot load my gift card to buy music and such!!!
-
I want to share files between my MacBook Pro and G5, I am using an AirPort
I want to share files between my MacBook Pro and G5, I am using an AirPort Extreme Base Station. I can see the MacBook Pro on the G5 and vice versa, I have file sharing turned on both, as well as Screen Sharing. I currently am sharing using Target Di
-
Error while creating Query based taxonomy.
Hi, I have created an index and trying to build a query based taxonomy though Taxonomy Query Builder in content management. Earlier I have created another index but after that I have deleted it but still while trying to build a query based taxonomy i
-
Environment open flags and multithreading
Do I actually need to create an environment explicitly if I want to read only from a database in a multithreaded program (no other process, no write operations)? I don't need to use DB_INIT_LOCK as there is no thread writing to the database. And I do
-
Let me begin by saying that I've done the SAME THING for a long time with this Automator script, and it's worked flawlessly. I recently added some now automator actions (and later deleted them) thinking they were the culprit of why my "filter finder