How can i write the query for the below output
Hi,
I need this kind of output for my report.Please suggest me asap.It's urgent.
Item Description category subinvcode A B C D....................(All Subinventories)
1 AAAA FFF 5 8 (Quantity Values for the corresponding subinventories)
Plz help.
I still don't have a clue what you're going on about, but here's an example of pivoting that I've knocked up based on your scatty bit of data which may give some hint to you as to what to do....
SQL> create table inventory as
2 select 1 as item_id, '0016K8731' as item_desc from dual union
3 select 2, '0014R0181' from dual;
Table created.
SQL>
SQL> create table sub_inventory as
2 select 1 as item_id, 'FG_IBM' as sub_item_id, 5 as quantity from dual union
3 select 1, 'FG_HUN', 4 from dual union
4 select 1, 'FG_PSA', 12 from dual union
5 select 2, 'FG_IBM', 1 from dual union
6 select 2, 'FG_HUN', 17 from dual union
7 select 2, 'FG_PSA', 3 from dual;
Table created.
SQL>
SQL> select item_desc, max(fg_ibm) as fg_ibm, max(fg_hun) as fg_hun, max(fg_psa) as fg_psa
2 from (
3 select i.item_desc,
4 decode(s.sub_item_id, 'FG_IBM', quantity, null) as fg_ibm,
5 decode(s.sub_item_id, 'FG_HUN', quantity, null) as fg_hun,
6 decode(s.sub_item_id, 'FG_PSA', quantity, null) as fg_psa
7 from inventory i, sub_inventory s
8 where s.item_id = i.item_id
9 )
10 group by item_desc
11 /
ITEM_DESC FG_IBM FG_HUN FG_PSA
0014R0181 1 17 3
0016K8731 5 4 12
SQL>
Similar Messages
-
How can i write the below code using "For all entries"
Hi
How can we write the below code using "for all entries" and need to avoid joins...
Please help
SELECT aaufnr aobjnr aauart atxjcd a~pspel
agstrp awerks carbpl cwerks
INTO TABLE t_caufv
FROM caufv AS a
INNER JOIN afih AS b
ON aaufnr = baufnr
INNER JOIN crhd AS c
ON bgewrk = cobjid
AND c~objty = 'D'
WHERE ( a~pspel = space
OR a~txjcd = space
OR NOT a~objnr IN
( select OBJNR from COBRB AS e
WHERE objnr = a~objnr ) )
AND a~werks IN s_plant
AND a~auart IN s_wtype
AND NOT a~objnr IN
( select OBJNR from JEST AS d
WHERE objnr = a~objnr
AND ( dstat = 'A0081'OR dstat = 'A0018' )
AND d~inact 'X' ).
Reward points for all helpfull answers
Thanks
Ammi.Hi,
SELECT objnr objid aufnr
from afih
into table t_afih.
SELECT objnr
from JEST
into table t_JEST
where stat = 'A0045'
OR stat = 'A0046'
AND inact 'X'.
SELECT objnr
from COBRB
into table t_cobrb.
SELECT arbpl werks objid objty
from crhd
INTO table it_crhd
FOR ALL ENTRIES IN it_afih
WHERE objty eq 'D'
AND gewrk = it_afih-objid.
SELECT aufnr objnr auart txjcd pspel gstrp werks aufnr
FROM caufv
INTO table t_caufv
FOR ALL ENTRIES IN it_afih
WHERE aufnr = it_afih-aufnr
And pspel = ' '
AND txjcd = ' '
ANd objnr ne it_crhd-objnr
AND auart in s_wtype
AND werks in s_plant.
AND objnr ne it_jest-objnr.
dont use NE in the select statements, it may effect performance also. Instead use if statements inside
loops.
loop at t_caufv.
read table it_chrd............
if t_caufv-objnr ne it_chrd-objnr.
read table it_jest..........
if if t_caufv-objnr ne it_jest-objnr.
(proceed further).
endif.
endif.
endloop.
hope this helps.
Reward if useful.
Regards,
Anu -
How can I write a query for this table?
Dear friends
I have a table with the following structur and data
ID Name Value
1 book 100
2 book 200
3 car 25
4 car 35
5 book 300
now I would like write a query with following out put
Name value
book 100 , 200 , 300
car 25 , 35
(with , Separator) (my oracle version is 10g)
thanksTry this,
SQL> WITH t AS(SELECT 'book' NAME, 100 VALUE FROM dual UNION ALL
2 SELECT 'book', 200 FROM dual UNION ALL
3 SELECT 'car', 25 FROM dual UNION ALL
4 SELECT 'car', 35 FROM dual UNION ALL
5 SELECT 'book', 300 FROM dual)
6 SELECT NAME, LTRIM (MAX (SYS_CONNECT_BY_PATH (VALUE, ',')), ',') VALUE
7 FROM (SELECT NAME, VALUE, ROW_NUMBER () OVER (PARTITION BY NAME ORDER BY VALUE) rn FROM t)
8 START WITH rn = 1
9 CONNECT BY PRIOR rn + 1 = rn
10 AND PRIOR NAME = NAME
11 GROUP BY NAME;
NAME VALUE
book 100,200,300
car 25,35
2 rows selected.
SQL> G. -
How can i write sql query for this result ?
Hello Dear,
Here is the script first.
CREATE TABLE ACC_TEST(
AD_ID NUMBER,
AD_NAME VARCHAR2(50),
AD_SPM_ID NUMBER);
/data are
Insert into ACC_TEST (AD_ID,AD_NAME,AD_SPM_ID) values (136,'Saleh Ahmed',129);
Insert into ACC_TEST (AD_ID,AD_NAME,AD_SPM_ID) values (142,'Hamidur Rahman',136);
Insert into ACC_TEST (AD_ID,AD_NAME,AD_SPM_ID) values (124,'Jasim Uddin',null);
INSERT INTO ACC_TEST (AD_ID,AD_NAME,AD_SPM_ID) VALUES (129,'Sazib',124);I Need The Following Result When I Pass A Value Of Ad_Id. For Example I Pass 142 Then Result Should Be
Select Ad_Id,Ad_Name
From..
where ad_id=142
Ad_Id Ad_Name
136 Saleh Ahmed
129 Sazib
124 Jasim Uddin
If I Pass Ad_Id=136 Then Result Should Be
Ad_Id Ad_Name
129 Sazib
124 Jasim Uddin
If I Pass Ad_Id=129 Then Result Should Be
Ad_Id Ad_Name
124 Jasim Uddin Database 10G XE
Any help will be helpfulHi,
HamidHelal wrote:
WoW ! you acutely got my point. How did you understand that ? lLuck guess. Guessing is usually not the best way to solve problems. It's usually faster and more reliable to say exactly what you want, as well as give an example.
ittle bit more i want to know, if i want to restrict the output not more then 2, what would be sql ?Now you're not even giviing an example!
Maybe you want something like this:
SELECT ad_id
, ad_name
FROM acc_test
WHERE LEVEL BETWEEN 2 AND 3 -- Changed
START WITH ad_id = :target_ad_id
CONNECT BY ad_id = PRIOR ad_spm_id
;which will show jsut the parent and the grandparent of the given row.
I do work with forms developer very much. Sql knowledge is as oracle sql book(cerfitication 9i). But this type of sql isn't available there.
where can i learn this type of sql ? Different sql then ordinary ?Certification is a different topic entirely.
There are books and web sites dealing with more advanced techniques. Sorry, I don't know any well enough to recommend them. Some authors (such as Tom Kyte) are consistently good.
Here are a couple of sites that explain CONNECT BY queries:
http://www.adp-gmbh.ch/ora/sql/connect_by.html
http://www.oradev.com/connect_by.jsp -
How can I write a query for this?
I have a table as below ,
room.........date.............inventory
A..............01/01.................5
A..............01/02.................5
A..............01/03.................5
A..............01/05.................5
A..............01/06.................5
A..............01/07.................8
I want the output as below
room.....begin_date........end_date......inventory
A............01/01.................01/03..........5
A............01/05.................01/06..........5
A............01/07.................01/07..........8
Is there any suggestion?
Thanks
nullwith x as
(select 'A' room, to_date ('01/01/2007', 'mm/dd/yyyy') d, 5 i from dual union all
select 'A' room, to_date ('01/02/2007', 'mm/dd/yyyy') d, 5 i from dual union all
select 'A' room, to_date ('01/03/2007', 'mm/dd/yyyy') d, 7 i from dual union all
select 'A' room, to_date ('01/04/2007', 'mm/dd/yyyy') d, 7 i from dual union all
select 'A' room, to_date ('01/05/2007', 'mm/dd/yyyy') d, 5 i from dual union all
select 'A' room, to_date ('01/06/2007', 'mm/dd/yyyy') d, 5 i from dual
select min (d)
, max (d)
, min (i)
from (
select room
, d
, i
, max (g) over (order by d) mg
from
(select room
, d
, i
, case when lead (i) over (partition by grp order by d) = i
then rownum
end g
from (
select room
, d
, i
, d - rownum grp
from x
order by d
group by mg -
How can we write the code for opening the command prompt and closing the
how can we write the code in java for opening the command prompt and closing the cmd prompt from eclipse (cmd prompt should close when click on the turminate button in eclipse)
rakeshsikha wrote:
how can we write the code for opening the command prompt and closing theBy typing in Eclipse (which you seemingly have)? -
How can i write the trigger for Global Temporary Table
Hi Grus,
How can i write the trigger for Global Temporary Table.
I was created the GTT with trigger using the below script .
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
EMP_C_NAME VARCHAR2(20 BYTE)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE OR UPDATE OR INSERT
ON GLOBAL_TEMP
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
END;
trigger was create successfully, but the wouldn't insert into to EMPNAME Table..
Please guide whether am correct or not? if not kindly give a correct syntax with example
Thanks in Advance,
Arun M MBEGIN
INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
END;
you are referencing old value in insert stmt.
BEGIN
INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
END;then run ur application it works fine...
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
EMP_C_NAME VARCHAR2(20 BYTE)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE OR UPDATE OR INSERT
ON GLOBAL_TEMP
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
dbms_output.put_line(:OLD.EMP_C_NAME||'yahoo');
INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
dbms_output.put_line(:OLD.EMP_C_NAME);
END;
create table EMPNAME as select * from GLOBAL_TEMP where 1=2
insert into GLOBAL_TEMP values('fgfdgd');
commit;
select * from GLOBAL_TEMP;
select * from EMPNAME;
output:
1 rows inserted
commit succeeded.
EMP_C_NAME
fgfdgd
1 rows selected
EMP_C_NAME
fgfdgd
1 rows selectedgot it Arun
Edited by: OraclePLSQL on Dec 28, 2010 6:07 PM -
How can i write the floats value in Unitronics vision230 plc using modbus Ethernet
How can i write the Float value in unitronics Vision230 PLC usinsg modbus ethernet (MB Ethernet Master Query.vi) I read and write the 32 bit register, for e.g i want to write the 23.45 value on 2nd add. of MF. And MF register is 32 bit register. I read and write the 32 bit register.
Narendra.
Solved!
Go to Solution.Thanks Amit for your solution but i can not use the string to write the value because MB Ethernet master Query.vi only accepet the integer value its not take string values or any other i.e floats values etc.....otherwise i have no problem to write or read the 32 bit register values , only problem is that the MB Ethernet master Query.vi only accept the integer value there4 how can write the float value.
Narendra
Message Edited by Artemistech on 01-30-2009 11:06 PM -
How can I write the analogous code to the logic:iterate tag functionality
Hai This is Rayalu .And I am very new to the Java World. I have a doubt?.How can I write the analogous code to the<logic:iterate> tag functionality using the JSP Tag Libraries . Pleae Send me some examples .
Hi,
SELECT objnr objid aufnr
from afih
into table t_afih.
SELECT objnr
from JEST
into table t_JEST
where stat = 'A0045'
OR stat = 'A0046'
AND inact 'X'.
SELECT objnr
from COBRB
into table t_cobrb.
SELECT arbpl werks objid objty
from crhd
INTO table it_crhd
FOR ALL ENTRIES IN it_afih
WHERE objty eq 'D'
AND gewrk = it_afih-objid.
SELECT aufnr objnr auart txjcd pspel gstrp werks aufnr
FROM caufv
INTO table t_caufv
FOR ALL ENTRIES IN it_afih
WHERE aufnr = it_afih-aufnr
And pspel = ' '
AND txjcd = ' '
ANd objnr ne it_crhd-objnr
AND auart in s_wtype
AND werks in s_plant.
AND objnr ne it_jest-objnr.
dont use NE in the select statements, it may effect performance also. Instead use if statements inside
loops.
loop at t_caufv.
read table it_chrd............
if t_caufv-objnr ne it_chrd-objnr.
read table it_jest..........
if if t_caufv-objnr ne it_jest-objnr.
(proceed further).
endif.
endif.
endloop.
hope this helps.
Reward if useful.
Regards,
Anu -
How can i write the data to PIC16F819 using labview?
how can i write the data to PIC16F819 using labview?
Need help!
im using labview in gathering the datas that i need to right to the PIC, then after getting all the datas i am using another program which is ICD2 in order to write it to the PIC. Is it possible to do this task through LV? coz we are spending a lot of time transferring the data from LV to ICD2 manually and its prone to mistake as well.
any suggestion?
thanks,
PedzLabVIEW does not currently have a built-in method to communicate with
i2c, but there are other vendors that sell devices to communicate in
this manner with LabVIEW development kits. One that I know of is
from MCC... here is a link: http://www.mcc-us.com
They sell a device called iPort, and then you can buy LabVIEW VIs to go with it. I hope this is helpful to you!
john m -
How can I write the chinese characters in a web with my magic mouse?
How can I write the chinese characters in the search box with my magic mouse?
You can do it with a trackpad but I am not sure about the mouse. Take a look at his link, http://support.apple.com/kb/HT4288
-
How can i write the image in gif or jpeg format??
how can i write the image in gif or jpeg format??
thx someone else help me in another topic
-
KM Search: How can I define a query for the user who currently logged on?
Hello,
I want to use the KM Search iView to display all documents from the currently logged on user in a certain sort order. The result should be some kind of report for the user...
In the search option I can define a default sort order. And I can also define it for a special user with cm_modifiedby(value=username)
But how can I define the predefined property value generically for the current user?
I tried to insert following values in the parameter Predefined Properties of the search option:
Predefined Properties (csv): cm_modifiedby(value=<user.id>)
Predefined Properties (csv): cm_modifiedby(value=%user.id%) -> like in the predefined properties
Predefined Properties (csv): cm_modifiedby(value=$sap_user) -> like in the xml forms builder
But non of these 3 parameters worked. Has anybody an idea what the right variable is?
Thanks a lot.
Best regards
NicoleHi Nicole,
1. First of all you need to use "<User.UserID>" to get the currently logged on user.
2. You need to create an AppIntegrator iView (so based on com.sap.portal.appintegrator.sap.Generic) in order to be able to use this dynamical parameter. The parameter "URL template" should look like:
<Request.Protocol>://<Request.Server>/irj/servlet/prt/portal/prtroot/com.sap.km.cm.basicsearch?layoutSetMode=exclusive&ResourceListType=com.sapportals.wcm.SearchResultList&SearchType=quick&rndLayoutSet=SearchResultLayoutSet&SearchCompsName=UISearchComponents&QueryString=*&SelectedCustomProps=cm_modifiedby(value=<User.UserID>)
Best regards,
Robert -
How can i write the code in xml publisher desktop
hi all
How and where can i write the code in xml publisher desktop ???
shall i know how to write xml code or what ??
in which part can i write the code if i have more than one query ?hi dear
Thanks for ur replay...
What i mean is : i used to work on reports builder,so :
1- i used to create more than query in some reports.
2- create formulas ,procedures....
NOW i want to create the same reports by using xml publisher desktop, so how can i do that...
when i use {color:#ff0000}report wizard{color}, i can not or i don`t know how to use more than one query, create formulas or procedures.
Please help me.
Thanks again. -
I want to wrtie some ECPM code
but I don't know how can i write code in IViewo
How to install or enable EPCF development enviroment
Where should i write the EPCF code?Hi,
Try this link for EPCF:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/enterprise portal client.pdf
<b>Regards,
Sai Krishna.
PS: Plz do assign points if it helps. ;-)</b> -
CSS SSL Proxy - how can I write the original source address in http header
I'm replacing some BigIP's with CSS11500's that are configured to do front/backend ssl proxying in a one-armed configuration. The BigIP's write the original source IP address as a http header value when the traffic is sent to the application, and the application uses the IP to match against an application ACL. How can I do the same in the CSS.
thanks,
Brianhere is what you can insert with the SSL module :
http://www.cisco.com/en/US/products/hw/contnetw/ps792/products_configuration_guide_chapter09186a0080292a76.html#wp1027619
Gilles.
Maybe you are looking for
-
How to aggregate the measue when click '∑' ?
Hi Experts, How to aggregate the measue when click '∑' ? For example: In table view. A-----------A1-----------2 A-----------A2-----------3 ATotal-------------------5 B-----------B1-----------2 B-----------B2-----------3 BTotal-------------------5 GrT
-
PPC G4 Tower dual 1.25 GHz: Where to find the 9.22 OS install disks
There are some old discussions of this, but by starting a new thread perhaps a solution will be obtained. I acquired two PPC G4 dual 1.25 GHz towers. They do not NOT have FW800. They have only FW400, thus OS 9.22 should install and work. Do not
-
AP Cannot join WLC, i have RADIUS authorization is pending for the AP Error
Hi Support, I'm new in installing WIFI, I have WLC 2504 using 7.4.100.0 I have AP 1600 (AIR-CAP1602E-E-K9) I installed the WLC and AP in a cisco poe switch, wlc and ap are in the same subnet and can ping ap from WLC, but the AP cannot join the wlc. i
-
Apple remote 8.0.2 Logic Pro 8 doesn´t work
I got 8.0.2 Logic Pro 8 on a Mac Mini with 10.6.8 The remote doesn´t work.wasn´t this issue fixed? Its not the pairing, its not the battery, i got three apple remotes (I guess it was wasted money) and they do work on other programs but not Logic as t
-
I NEED HELP!!! My problem is that my IMac is getting really slow and i want to fix that, i havent buyd any memory chips yet but i think i will but i want to restart my whole computer so its like all new bought and its not going to be slow anymore