Help need to create a query
I need to fetch records from a table. Please help me to create a query
The Tablename is Employee. It has the following records
Department Empname Gender
Finance Tom Male
Finance Rick Male
Finance Stacy Female
Corporate Tom Male
Corporate Rob Male
I want to select the value of the Gender field from the Employee table corresponding to a Department
If all the values in the Gender field are 'MALE' corresponding to 'finance' in the Department field, the value should be 'MALE'
If there is a value 'FEMALE', the gender corresponding to the Empname 'TOM' should be considered as the gender
Tables have rows - not records.
Your question is a basic SQL language question - which means you do not know the SQL language. This forum is not a classroom for teaching you the SQL language.
Use the following as the basic outline of how your SQL language statement need to look like for selecting the required from the table:
SELECT
<<sql projection goes here>>
FROM <<table name goes here>>
WHERE <<filter conditions go here>>
{code}
The SQL projection specifies the list of columns the SQL need to return to the caller.
The filter condition is basic predicates and AND and OR can be used for multiple predicates.
Go to http://tahiti.oracle.com and look for the +SQL Reference Guide+ for the Oracle version you are using. The +SELECT+ statement syntax is covered in detail and sample statements are provided.
And please do not expect this forum to be used as a classroom, or expect this forum to do your homework for a class.
Similar Messages
-
Help needed to optimize the query
Help needed to optimize the query:
The requirement is to select the record with max eff_date from HIST_TBL and that max eff_date should be > = '01-Jan-2007'.
This is having high cost and taking around 15mins to execute.
Can anyone help to fine-tune this??
SELECT c.H_SEC,
c.S_PAID,
c.H_PAID,
table_c.EFF_DATE
FROM MTCH_TBL c
LEFT OUTER JOIN
(SELECT b.SEC_ALIAS,
b.EFF_DATE,
b.INSTANCE
FROM HIST_TBL b
WHERE b.EFF_DATE =
(SELECT MAX (b2.EFF_DATE)
FROM HIST_TBL b2
WHERE b.SEC_ALIAS = b2.SEC_ALIAS
AND b.INSTANCE =
b2.INSTANCE
AND b2.EFF_DATE >= '01-Jan-2007')
OR b.EFF_DATE IS NULL) table_c
ON table_c.SEC_ALIAS=c.H_SEC
AND table_c.INSTANCE = 100;To start with, I would avoid scanning HIST_TBL twice.
Try this
select c.h_sec
, c.s_paid
, c.h_paid
, table_c.eff_date
from mtch_tbl c
left
join (
select sec_alias
, eff_date
, instance
from (
select sec_alias
, eff_date
, instance
, max(eff_date) over(partition by sec_alias, instance) max_eff_date
from hist_tbl b
where eff_date >= to_date('01-jan-2007', 'dd-mon-yyyy')
or eff_date is null
where eff_date = max_eff_date
or eff_date is null
) table_c
on table_c.sec_alias = c.h_sec
and table_c.instance = 100; -
Hi Experts,
I have a query in my devlopment box and i need to create similar query in development box only, so is there any copy option for this?
Thanks in advance
Davidhi
Open you Query in Bex designer and 'Save As' with a different description and technical name,
cheers
Umesh -
Need to create report query to get latest open and last closed period for given application
Hi All,
I need to create a report query to get below result displayed in report output.
1) - Application name
2) - Ledger name
-o/ -Operating Unit
3) - Last Closed Period
4) - Current Open Period
5) - Date Closed – Last Closed Period
6) - Date Open – Current Open Period
I tr I tried to create the query below is the same. Please let me know if it looks fine.
SELECT *
FROM (SELECT fav.application_name ,
hou.name Operating_Unit_Name,
gl.name Ledger_name,
gl.latest_opened_period_name,
gps.period_name Period_Name,
DECODE(gps.closing_status, 'O', 'Open', 'C', 'Closed') status,
gps.last_update_date Last_status_modified_date
FROM gl_period_statuses gps,
gl_sets_of_books gsob,
fnd_application_vl fav,
hr_operating_units hou,
gl_ledgers gl
WHERE gps.period_name = gps.period_name
AND gps.closing_status ='C'
AND fav.application_short_name =
NVL('&p_application_short_name', fav.application_short_name)
AND gps.application_id = fav.application_id
AND gsob.set_of_books_id = gps.set_of_books_id
AND hou.set_of_books_id = gps.set_of_books_id
AND gl.ledger_id = gsob.set_of_books_id
AND hou.organization_id=NVL('&p_operating_unit',hou.organization_id)
AND gl.ledger_id=NVL('&p_ledger_id',gl.ledger_id)
ORDER BY gps.last_update_date desc )WHERE ROWNUM = 1
UNION ALL
SELECT *
FROM (SELECT fav.application_name Application_Name,
hou.name Operating_Unit_Name,
gl.name Ledger_name,
gl.latest_opened_period_name,
gps.period_name Period_Name,
DECODE(gps.closing_status, 'O', 'Open', 'C', 'Closed') status,
gps.last_update_date Last_status_modified_date
FROM gl_period_statuses gps,
gl_sets_of_books gsob,
fnd_application_vl fav,
hr_operating_units hou,
gl_ledgers gl
WHERE gps.period_name = gps.period_name
AND gps.closing_status = 'O'
AND fav.application_short_name =
NVL('&p_application_short_name', fav.application_short_name)
AND gps.application_id = fav.application_id
AND gsob.set_of_books_id = gps.set_of_books_id
AND hou.set_of_books_id = gps.set_of_books_id
AND gl.ledger_id = gsob.set_of_books_id
AND hou.organization_id=NVL('&p_operating_unit',hou.organization_id)
AND gl.ledger_id=NVL('&p_ledger_id',gl.ledger_id)
ORDER BY gps.last_update_date desc)
WHERE ROWNUM = 1It is within the table I believe (I'm not a DBA or a developer) since I created a BLOB column and then used the file browse feature to allow users to attach a resume to the table in order to be able to perform a search of the attached documents.
I'm just having a hard time pointing the link in the search results report to the document in the blob column.
The information on that page is great if you're trying to create a link to the document on the initial report.
But I created a query using Oracle Text to run a report that does a boolean search of the attached word documents in the table.
When it displays the search results, it doesn't create a link to the document and I can't figure out how to do it.
Here's a link the the instructions I used to create the initial search report with Oracle Text, mind you I only created the index and query, I didn't add in all the link data since they're using documents on websites and I'm using documents in a table.
http://www.oracle.com/technology/products/database/application_express/pdf/apex_text_application_v1.6.pdf
If you can help me with this I'd really appreciate it.
Thanks again.
Greg
Edited by: gjones77 on Dec 2, 2008 8:14 AM -
Help: How to create a query like this?
I am working on a report and I am facing on a question like this:
TABLE TEST has two columns A and B
A B
2 INFO21
2 INFO22
3 INFO31
3 INFO32
3 INFO33
I'd like to create a query which will return
A INFO
2 INFO21, INFO22
3 INFO31, INFO32, INFO33
Please help.
Thank you in advance
JimmyA lot of pretty fine examples here:
http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
Rgds. -
Help needed to tune the Query:Statistics added
Can someone DBA please help me to tune this query:
SELECT DISTINCT K.ATTRIBUTE_VALUE AGENCY_ID,B.PROFILE_NM ,NVL(G.OFFICE_DESC,'--') OFFICE_DESC,f.OFFICE_ID,B.PROFILE_ID,'%' ROLE,'%' LAYOUT,
CASE
WHEN 'flagB' = '%' THEN
NVL(J.ISS_GRP_DESC,'BILLING')
WHEN 'flagO' = '%' THEN
NVL(J.ISS_GRP_DESC,'ORDERING')
WHEN 'flag' = '%' THEN
NVL(J.ISS_GRP_DESC,'BILLING/ORDERING')
ELSE
NVL(J.ISS_GRP_DESC,' ')
END ISS_GRP_DESC,
DECODE(NVL(H.USERID,' ') ,' ','--','<a sbcuid_in=' || H.USERID || ' target=NEW >'||H.FIRSTNAME || ' ' || H.LASTNAME || '( ' || H.USERID || ' )</a>' ) USER_NAME
FROM
PROFILE_PORTAL B ,
TBL_BDA_AGENCY_RESP_REP C ,
TBL_BDA_AGENCY_OFFICE F,
TBL_BDA_OFFICE G,
USERS_PORTAL H,
TBL_BDA_USR_ISS_GRP I ,
TBL_BDA_ISS_GROUP J,
ATTRIBUTE_VALUES_PORTAL K,
PROFILE_TYPE_PORTAL L
WHERE
B.PROFILE_ID = F.AGENCY_ID (+)
AND B.PROFILE_ID = C.AGENCY_ID (+)
AND G.OFFICE_ID (+)= F.OFFICE_ID
AND H.USERID (+)= C.RESP_USR_ID
AND C.ISS_GRP_ID = I.ISS_GRP_ID (+)
AND I.ISS_GRP_ID = J.ISS_GRP_ID(+)
AND 'PROFILE.'||B.PROFILE_ID = K.ENTITY_ID(+)
AND K.ATTRIBUTE_VALUE IS NOT NULL
AND L.PROFILE_TYPE_ID = B.PROFILE_TYPE_ID
AND L.APPLICATION_CD='BDA'
AND NOT EXISTS (SELECT agency_id
FROM TBL_BDA_AGENCY_RESP_REP t
WHERE t.ISS_GRP_ID IN ('%')
AND t.AGENCY_ID = C.AGENCY_ID)
AND K.ATTRIBUTE_VALUE LIKE '%'
AND UPPER(B.PROFILE_NM) LIKE UPPER('%')
AND (to_char(NVL(B.PROFILE_ID,0)) LIKE '%' OR NVL(B.PROFILE_ID,0) IN ('a'))
AND NVL(G.OFFICE_ID,0) IN ('%')
AND (to_char(NVL(C.RESP_USR_ID,'0')) LIKE '%' OR NVL(C.RESP_USR_ID,'0') IN ('k'))
ORDER BY PROFILE_NM
The number of rows in these tables are as follows:
PROFILE_PORTAL -- 2392
TBL_BDA_AGENCY_RESP_REP 3508
TBL_BDA_AGENCY_OFFICE 2151
TBL_BDA_OFFICE 3
USERS_PORTAL 270500
TBL_BDA_USR_ISS_GRP 234
TBL_BDA_ISS_GROUP 2
ATTRIBUTE_VALUES_PORTAL 2790
PROFILE_TYPE_PORTAL 3
The Explain pal nhas given this o/p to me:
SQL> select * from table(dbms_xplan.display) dual;
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost |
| 0 | SELECT STATEMENT | | 807 | 102K| | 2533 |
| 1 | SORT UNIQUE | | 807 | 102K| 232K| 82 |
|* 2 | FILTER | | | | | |
|* 3 | HASH JOIN OUTER | | 807 | 102K| | 52 |
|* 4 | HASH JOIN OUTER | | 807 | 95226 | | 40 |
|* 5 | TABLE ACCESS BY INDEX ROWID | ATTRIBUTE_VALUES | 1 | 23 | | 2 |
| 6 | NESTED LOOPS | | 7 | 805 | | 37 |
| 7 | NESTED LOOPS OUTER | | 6 | 552 | | 25 |
|* 8 | FILTER | | | | | |
| 9 | NESTED LOOPS OUTER | | | | | |
|* 10 | FILTER | | | | | |
| 11 | NESTED LOOPS OUTER | | | | | |
| 12 | NESTED LOOPS OUTER | | 3 | 141 | | 10 |
|* 13 | HASH JOIN | | 3 | 120 | | 7 |
|* 14 | TABLE ACCESS FULL | PROFILE | 6 | 198 | | 4 |
|* 15 | TABLE ACCESS FULL | PROFILE_TYPE | 1 | 7 | | 2 |
|* 16 | INDEX RANGE SCAN | SYS_C0019777 | 1 | 7 | | 1 |
| 17 | TABLE ACCESS BY INDEX ROWID| TBL_BDA_OFFICE | 1 | 10 | | 1 |
|* 18 | INDEX UNIQUE SCAN | SYS_C0019800 | 1 | | | |
| 19 | TABLE ACCESS BY INDEX ROWID | TBL_BDA_AGENCY_RESP_REP | 2 | 26 | | 2 |
|* 20 | INDEX RANGE SCAN | IDX_AGECYRESP_AGNCYID | 2 | | | 1 |
| 21 | TABLE ACCESS BY INDEX ROWID | USER_ | 1 | 22 | | 1 |
|* 22 | INDEX UNIQUE SCAN | USER_PK | 1 | | | |
|* 23 | INDEX RANGE SCAN | IDX_ATTVAL_ENTATTID | 1 | | | 1 |
| 24 | TABLE ACCESS FULL | TBL_BDA_USR_ISS_GRP | 234 | 702 | | 2 |
| 25 | TABLE ACCESS FULL | TBL_BDA_ISS_GROUP | 2 | 24 | | 2 |
|* 26 | TABLE ACCESS BY INDEX ROWID | TBL_BDA_AGENCY_RESP_REP | 1 | 7 | | 3 |
|* 27 | INDEX RANGE SCAN | IDX_AGECYRESP_AGNCYID | 2 | | | 1 |
Predicate Information (identified by operation id):
2 - filter( NOT EXISTS (SELECT /*+ */ 0 FROM "TBL_BDA_AGENCY_RESP_REP" "T" WHERE "T"."AGENCY_ID"=:B1
AND "T"."ISS_GRP_ID"=TO_NUMBER('%')))
3 - access("I"."ISS_GRP_ID"="J"."ISS_GRP_ID"(+))
4 - access("SYS_ALIAS_1"."ISS_GRP_ID"="I"."ISS_GRP_ID"(+))
5 - filter("K"."ATTRIBUTE_VALUE" IS NOT NULL AND "K"."ATTRIBUTE_VALUE" LIKE '%')
8 - filter(NVL("SYS_ALIAS_1"."RESP_USR_ID",'0') LIKE '%' OR NVL("SYS_ALIAS_1"."RESP_USR_ID",'0')='k')
10 - filter(NVL("G"."OFFICE_ID",0)=TO_NUMBER('%'))
13 - access("L"."PROFILE_TYPE_ID"="B"."PROFILE_TYPE_ID")
14 - filter(UPPER("B"."PROFILE_NM") LIKE '%' AND (TO_CHAR(NVL("B"."PROFILE_ID",0)) LIKE '%' OR
NVL("B"."PROFILE_ID",0)=TO_NUMBER('a')))
15 - filter("L"."APPLICATION_CD"='BDA')
16 - access("B"."PROFILE_ID"="F"."AGENCY_ID"(+))
18 - access("G"."OFFICE_ID"(+)="F"."OFFICE_ID")
20 - access("B"."PROFILE_ID"="SYS_ALIAS_1"."AGENCY_ID"(+))
22 - access("H"."USERID"(+)="SYS_ALIAS_1"."RESP_USR_ID")
23 - access("K"."ENTITY_ID"='PROFILE.'||TO_CHAR("B"."PROFILE_ID"))
26 - filter("T"."ISS_GRP_ID"=TO_NUMBER('%'))
27 - access("T"."AGENCY_ID"=:B1)
Note: cpu costing is off
57 rows selected.
Elapsed: 00:00:01.08
Please help me.
Aashish S.Hello Eric,
Here is the code:
SELECT DISTINCT
K.ATTRIBUTE_VALUE AGENCY_ID,
B.PROFILE_NM ,
NVL(G.OFFICE_DESC,'--') OFFICE_DESC,
f.OFFICE_ID,
B.PROFILE_ID,
'%' ROLE,
'%' LAYOUT,
case
WHEN 'flagB' = '%' THEN
NVL(J.ISS_GRP_DESC,'BILLING')
WHEN 'flagO' = '%' THEN
NVL(J.ISS_GRP_DESC,'ORDERING')
WHEN 'flag' = '%' THEN
NVL(J.ISS_GRP_DESC,'BILLING/ORDERING')
else
NVL(J.ISS_GRP_DESC,' ')
END ISS_GRP_DESC,
DECODE(NVL(H.USERID,' ') ,' ','--','<a sbcuid_in=' || H.USERID || ' target=NEW >'||H.FIRSTNAME || ' ' || H.LASTNAME ||
'( ' || H.USERID || ' )</a>' ) USER_NAME
from
PROFILE_PORTAL B ,
TBL_BDA_AGENCY_RESP_REP C ,
TBL_BDA_AGENCY_OFFICE F,
TBL_BDA_OFFICE G,
USERS_PORTAL H,
TBL_BDA_USR_ISS_GRP I ,
TBL_BDA_ISS_GROUP J,
ATTRIBUTE_VALUES_PORTAL K,
PROFILE_TYPE_PORTAL L
WHERE
B.PROFILE_ID = F.AGENCY_ID (+)
AND B.PROFILE_ID = C.AGENCY_ID (+)
AND G.OFFICE_ID (+)= F.OFFICE_ID
AND H.USERID (+)= C.RESP_USR_ID
AND C.ISS_GRP_ID = I.ISS_GRP_ID (+)
AND I.ISS_GRP_ID = J.ISS_GRP_ID(+)
AND 'PROFILE.'||B.PROFILE_ID = K.ENTITY_ID(+)
AND K.ATTRIBUTE_VALUE IS NOT NULL
AND L.PROFILE_TYPE_ID = B.PROFILE_TYPE_ID
AND L.APPLICATION_CD='BDA'
AND NOT EXISTS
(SELECT agency_id
FROM TBL_BDA_AGENCY_RESP_REP t
WHERE t.ISS_GRP_ID IN (1)
AND t.AGENCY_ID = C.AGENCY_ID)
AND K.ATTRIBUTE_VALUE LIKE '%'
AND UPPER(B.PROFILE_NM) LIKE UPPER('%')
AND (to_char(NVL(B.PROFILE_ID,0))
LIKE '%'
OR NVL(B.PROFILE_ID,0) IN (1))
AND NVL(G.OFFICE_ID,0) IN (1)
AND (to_char(NVL(C.RESP_USR_ID,'0'))
LIKE '%'
OR NVL(C.RESP_USR_ID,'0') IN ('%'))
ORDER BY PROFILE_NM
This is the Query and the query takes some mins. to run in prod environment.
From the Query plan ,I am not able to get any idea for optimization.
Now,Can you tell me which steps I need to follow to run it faster and which all modifications should be made?
Thanks.
Aashish S. -
Help needed to create Quik Time VR movies, step by step
Hello,
thank you for your attenction.
I need to create Quick time vr movies, and I need to know the exact sequance of steeps to do it, and if the starting point I use is correct.
1) I shooted a sequence of photos with my digital camera (for example: www.stebianchi.com/quicktimevrhelp/still-photo.jpg).
2) Then, with photoshop (CS4) I choose: Automate/photomerge and I select all them to joint them in a bigger 360° panoramic one (www.stebianchi.com/quicktimevrhelp/pan.jpg). If, untill here, all is correct, the first question: in photoshop Photomerge layout option, do I have to choose one voice "auto, perspective, cylindrical, spherical, etc..." rather than anoter one of these?
3) from here, I really need your help.
First of all: the great doubt:
My photos can not cover a spherical panorama, they're only a "ring" around a center (and not a spherical texture). To cover all the surface (or almost all, ok...) of my ambient, do I have to use a wider lens on my camera or there is a different solution (for ex a vertical photomerge?).
4) Done this, I think I shuold buy a software like Cubic converter, to set and export the QTVR movie. Right?
Thanks a lot guys,
all the best!
StefanoYou can call your local apple store(find one on the home page of apple.com) and they will give you instructions how to convert DVD to iPod. That is what they told me, but from what I heard, you may need more than Quicktime Pro. Just call and ask them, because if you make a manual of how to do it, it could help me a lot.
(I'm looking for a good DVD converter, already know some, beside the internet download ones) -
Help Needed in Creating Java Class and Java Stored Procedures
Hi,
Can anyone tell how can i create Java Class, Java Source and Java Resource in Oracle Database.
I have seen the Documents. But i couldn't able to understand it correctly.
I will be helpful when i get some Examples for creating a Java Class, Java Source and Stored Procedures with Java with details.
Is that possible to Create a Java class in the oracle Database itself ?.
Where are the files located for the existing Java Class ?..
Help Needed Please.
Thanks,
Murali.vHi Murali,
Heres a thread which discussed uploading java source file instead of runnable code on to the database, which might be helpful :
Configure deployment to a database to upload the java file instead of class
The files for the java class you created in JDev project is located in the myworks folder in jdev, eg, <jdev_home>\jdev\mywork\Application1\Project1\src\project1
Hope this helps,
Sunil.. -
Help needed in writing a query
Hi all,
Following is the structure of my table.
Data
Key Number
Id Number
Value varchar2(100)
activity_name varchar2(100)
Creation_Date Date
Eval_Point varchar2(100)
In the above table Id is the primary key.
The column eval_point holds only two types of entries 'activation' or 'completion'
The activity_name column holds the name of the activity.
The sample entries in the table are as follows
Key Value activity_name Creation_Date Id Eval_Point
260002 XXX assign_1 2007-09-21 16:58:41.920000 951 activation
260002 XXX assign_1 2007-09-21 16:58:43.392000 953 completion
260002 XXX assign_2 2007-09-21 16:59:03.732000 956 activation
260002 XXX assign_2 2007-09-21 16:59:04.112000 954 completion
260002 XXX assign_3 2007-09-21 16:59:24.331000 958 activation
260002 XXX assign_3 2007-09-21 16:59:24.421000 957 completion
i need to write a query which gives me data in the following format
value id start_date end_date
XXX YYY 2007-09-21 16:58:41.920000 2007-09-21 16:58:43.392000
where start_date is the creation date of the 'activation' and end_date is the creation_date of 'completion'.
Can somebody help?
-thanks
lavanyahello all,
I would like to re frame my question.
this is the output of the base query
select id,instance_key,sensor_target,activity_sensor,creation_date,eval_point from bpel_variable_sensor_values where instance_key=260002;
953 260002 Assign_1 952 2007-09-21 16:58:43.392000 completion
951 260002 Assign_1 952 2007-09-21 16:58:41.920000 activation
956 260002 Assign_2 955 2007-09-21 16:59:03.732000 activation
954 260002 Assign_2 955 2007-09-21 16:59:04.112000 completion
958 260002 Assign_3 959 2007-09-21 16:59:24.331000 activation
957 260002 Assign_3 959 2007-09-21 16:59:24.421000 completion
962 260002 Assign_4 960 2007-09-21 16:59:44.741000 completion
961 260002 Assign_4 960 2007-09-21 16:59:44.640000 activation
964 260002 Assign_5 965 2007-09-21 17:00:05.290000 completion
963 260002 Assign_5 965 2007-09-21 17:00:04.950000 activation
I am trying out this query
select a.instance_key,a.creation_date,b.creation_date,a.id
from bpel_variable_sensor_values a, bpel_variable_sensor_values b
where a.instance_key=b.instance_key
and a.instance_key=260002
and a.eval_point='activation'
and b.eval_point='completion'
and i am getting 25 entries i.e a cartesian product of a.creation_date
260002 2007-09-21 16:58:41.920000 2007-09-21 16:58:43.392000 951
260002 2007-09-21 16:58:41.920000 2007-09-21 16:59:04.112000 951
260002 2007-09-21 16:58:41.920000 2007-09-21 16:59:24.421000 951
260002 2007-09-21 16:58:41.920000 2007-09-21 16:59:44.741000 951
260002 2007-09-21 16:58:41.920000 2007-09-21 17:00:05.290000 951
260002 2007-09-21 16:59:03.732000 2007-09-21 16:58:43.392000 956
260002 2007-09-21 16:59:03.732000 2007-09-21 16:59:04.112000 956
260002 2007-09-21 16:59:03.732000 2007-09-21 16:59:24.421000 956
260002 2007-09-21 16:59:03.732000 2007-09-21 16:59:44.741000 956
260002 2007-09-21 16:59:03.732000 2007-09-21 17:00:05.290000 956
260002 2007-09-21 16:59:24.331000 2007-09-21 16:58:43.392000 958
260002 2007-09-21 16:59:24.331000 2007-09-21 16:59:04.112000 958
260002 2007-09-21 16:59:24.331000 2007-09-21 16:59:24.421000 958
260002 2007-09-21 16:59:24.331000 2007-09-21 16:59:44.741000 958
260002 2007-09-21 16:59:24.331000 2007-09-21 17:00:05.290000 958
260002 2007-09-21 16:59:44.640000 2007-09-21 16:58:43.392000 961
260002 2007-09-21 16:59:44.640000 2007-09-21 16:59:04.112000 961
260002 2007-09-21 16:59:44.640000 2007-09-21 16:59:24.421000 961
260002 2007-09-21 16:59:44.640000 2007-09-21 16:59:44.741000 961
260002 2007-09-21 16:59:44.640000 2007-09-21 17:00:05.290000 961
260002 2007-09-21 17:00:04.950000 2007-09-21 16:58:43.392000 963
260002 2007-09-21 17:00:04.950000 2007-09-21 16:59:04.112000 963
260002 2007-09-21 17:00:04.950000 2007-09-21 16:59:24.421000 963
260002 2007-09-21 17:00:04.950000 2007-09-21 16:59:44.741000 963
260002 2007-09-21 17:00:04.950000 2007-09-21 17:00:05.290000 963
can soembody help me to reduce these to 5 rows. -
Help needed in framing SQL query.
Hi,
I have table having following schema:
PRODUCT_ID INT
DATE DATETIME
ITEMS_SOLD INT
This table contains data for a week (sunday to saturday). I want to write an SQL query to get (filter out) PRODUCT_ID of products which has same no. of ITEMS_SOLD for all 7 days. Also for given PRODUCT_ID I need to find the longest period of successive days where the no. of ITEMS_SOLD is same for all days in this period. Eg.(PRODUCT_ID 23 was sold as following along the week in no. of units sold: 4,6,6,6,6,7,4 .So the longest period is *4 days* from Monday to Thursday.) The first condition is special case of second condition where no. of days is 7.
Any help to get the SQL query will be appreciated.
Thanks,
Akshay.PRODUCT_ID DATE ITEMS_SOLD
1 10/10/2011 3
1 11/10/2011 3
1 12/10/2011 3
1 13/10/2011 3
1 16/10/2011 5
2 10/10/2011 4
2 11/10/2011 4
2 12/10/2011 4
2 13/10/2011 4
2 14/10/2011 4
2 15/10/2011 4
2 16/10/2011 4
Output:
PRODUCT_ID ITEMS_SOLD NO_OF_DAYS
1 3 4
2 4 7
Explanation of results:
The table to be queried contains data for 1 week: from 10/10/2011(Sunday) to 16/10/2011(Saturday). Now, product with PRODUCT_ID '1' was sold on dates 10,11,12,13,16. Out of these 5 days 3 units were sold on 4 successive days (from 10-13). So output should be like :
PRODUCT_ID ITEMS_SOLD NO_OF_DAYS
1 3 4
as longest period of successive days is 4 where same no. of units were sold i.e 3 units (other period is of 1 day on 16th ).
For PRODUCT_ID 2 we have only one period of 7 days where 4 units were sold each day. So we output :
PRODUCT_ID ITEMS_SOLD NO_OF_DAYS
2 4 7
Other case where same PRODUCT_ID have different units sold on each day should be ignored.
I hope that clarifies the problem more. Let me know in case I have missed out anything which should have been mentioned.
-Akshay. -
Help needed for creating 1 invoice for 2 different material types.
Dear, Gurus
I really need help here I have spent 3 days cracking my head trying to solve the problem. Problem is client was creating invoice with reference to order and while invoice was being made it would cause an invoice split. The materials involved are Trading Good and Service Material. They would like only 1 invoice. Note nothing was different except material group and item cat. of the material. payment terms billing dates partners everything is same.
Current item config for Trading Good material is ZMPI-project item cat.
Copying requirements 023 Item ord.ref. w/o AZ Billing quantity A
Data VBRK/VBRP 000 Pos./neg. quantity +
Pricing type K
PricingExchRate type
Price source
Current item config for service Material is TAD-Service
Copying requirements 002 Item/order-related Billing quantity A
Data VBRK/VBRP 001 Inv.split (sample) Pos./neg. quantity +
Pricing type G
PricingExchRate type
Price source
I was told to change Data VBRK/VBRP to 003 One Invoice which I did in both of these item cat. and yes they worked perfectly but at time of creating the invoice for service material the qty that showed was 11. Note: In sales order it is 1 qty. So I went back into the config of item cat TAD and changed copying requirement to 023 instead of 002 but nothing changed. Seems a qty of 10 is referencing something else which I have no idea what or where it is picking this up from. Just to see or test things I went into the sales order and tried changing the service material qty then a weird popup appears and says service order 12344456 has been blocked. (Seriously I have no idea why this would happen or should be existing at all.) Even if for some reason it is being referenced the service order that is existing is qty 1.
I really really do need help and if someone can help me that would be god sent.
Regards, AliYou did not mention what value is maintained in the field billing quantity in the copy control->Item settings. Check for the service item, what value is assigned. Put value A and re-test.
Note that whenever you change any settings in configuration side, you need to create a new documents to test the results of the settings. You should not use the existing documents.
When you say the document is blocked, then check the status of the sales order to find the reason for blocking (like credit block, approval etc)..
Regards, -
Help needed to create a CSS 'style-switcher' button.
Hi,
I need some help please in creating alternate style sheets for each page on a site I'm creating to enable users to change text size (i.e. small, normal and large options - sometimes, symbolized as a letter 'A' in varying sizes). The site has been built in basic format so far but I would like to add these features for the sake of usability. There are no actual problems with the site as it currently works fine, it's just this one thing I need help with.
Is this possible using post-processing methods, (which I have no problem doing) and if so could someone kindly point me in the right direction? I've searched the iWeb forum using keywords most relevant to this question and have found nothing.
Any help greatly appreciated,
Matt
MacMini G4 1.42GHZ Mac OS X (10.4.8)Thanks varkgirl,
This works (partially): this is the page:
http://www.charitydesigns.com/odyssey/index.html
The first paragraph is not responding and at larger sizes line spacing is not in proportion to the size of the text (and is squashed), what am I doing wrong?
Hope you can assist. -
Urgent help needed....Query..
Hello Experts
Can someone help with writing a particular query. This is the test scenario
CREATE TABLE TEST (MONTH DATE,
AMOUNT NUMBER(17));
INSERT INTO TEST VALUES('01-FEB-06',100);
INSERT INTO TEST VALUES('01-MAR-06',100);
INSERT INTO TEST VALUES('01-APR-06',100);
INSERT INTO TEST VALUES('01-JUN-06',100);
INSERT INTO TEST VALUES('01-JUL-06',100);
INSERT INTO TEST VALUES('01-AUG-06',100);
INSERT INTO TEST VALUES('01-SEP-06',100);
INSERT INTO TEST VALUES('01-OCT-06',100);
INSERT INTO TEST VALUES('01-NOV-06',100);
INSERT INTO TEST VALUES('01-DEC-06',100);
INSERT INTO TEST VALUES('01-JAN-07',100);
INSERT INTO TEST VALUES('01-FEB-07',100);
INSERT INTO TEST VALUES('01-MAR-07',100);
INSERT INTO TEST VALUES('01-APR-07',100);
INSERT INTO TEST VALUES('01-MAY-07',100);
INSERT INTO TEST VALUES('01-JUN-07',100);
INSERT INTO TEST VALUES('01-JUL-07',100);
INSERT INTO TEST VALUES('01-AUG-07',100);
INSERT INTO TEST VALUES('01-SEP-07',100);
INSERT INTO TEST VALUES('01-OCT-07',100);
INSERT INTO TEST VALUES('01-NOV-07',100);
INSERT INTO TEST VALUES('01-DEC-07',100);
INSERT INTO TEST VALUES('01-JAN-08',100);
INSERT INTO TEST VALUES('01-FEB-08',100);
INSERT INTO TEST VALUES('01-MAR-08',100);
INSERT INTO TEST VALUES('01-APR-08',100);
INSERT INTO TEST VALUES('01-MAY-08',100);
INSERT INTO TEST VALUES('01-JUN-08',100);
Ok so thats my test table, I want a query which will give me the sum of the field Amount grouping by Year but it should give me the sum of the month from July 06 till July 07. For Example if i put the Date Range from 2003 to 2006 then it should give me out put by group the year from july till next year jun.
It should look something like this
Year Amount
07-2005/06-2006 5000
07-2006/06-2007 2000
07-2007/06-2008 1200
Can i get a query which will group in the above manner???
Thanks & Regards
vihangSQL> select '07'||extract(year from add_months(month,-7))||
2 '-07'||extract(year from add_months(month,5)) yr,
3 sum(amount) amt
4 from test
5 group by '07'||extract(year from add_months(month,-7))||
6 '-07'||extract(year from add_months(month,5));
YR AMT
072007-072008 1100
072006-072007 1200
072005-072006 500.
Message was edited by:
jeneesh -
Help needed to create Notification in IW21 tr code using BAPI
<b>Hi Experts,
I am searching for some BAPI's of IW21 tr code, where I need to create Notification using the details of some legasy system/flat file. I dont wanna use BDC, I need to use BAPI so could anyone help me out.
Thanks in advance,
Sunil</b><b>Hi Surya,
Thanx for your reply, if u have the program to create the notification could you please send me,,,, I need it urgently....I have a Z-table which has the datas like;
CusomerName
Customeraddress
Work_order_type
Work_order_priority.........and so on...
Now I need to create notification using the same datas....
Thanks in advance..
Sunil</b> -
Help needed to create desktop application background using javaFx.
Hi,
i need to create background for my desktop application in JavaFx. It have top side bottom menu bars to place icon buttons for my app. The whole scene need to resize. I had tried this using
JavaFx composer. But my issue is like in java swing i can not able to create different panels and set different styles. Please help me on this issue.
Thankyou.Hi mate take a rectangle and fill it to scene width !
use fill gradient and bind it to your main scene.width
for example :
Rectangle {
fill: color.Blue
stroke: LinearGradient {
startX: 125.0, startY: 0.0, endX: 225.0, endY: 0.0
proportional: false
stops: [
Stop { offset: 0.0 color: Color.web("#1F6592") }
Stop { offset: 1.0 color: Color.web("#80CAFA") }
use appropriate start and offset then bind it to scene width and height.
width : bind scene.width;
height : bind scene.height ;
Maybe you are looking for
-
Can I use it with time machine and then use it to store stuff on as well?? Or when I plug it in will it back up automatically and I can't do anything else with it?? Thanks for your help
-
Problem when installing oracle 10g on RHEL-4
greetings, i have been trying to install oracle 10g on my linux machine for the past 10 days, everytimje i do all the steps and change the kernel parameters but when i start the runinstaller file. i get the folloeing error. I don't know what this err
-
HI Is it possible to call a Java program in OWB_902560. If so how ...Pls. advice me.. Thanks Narasimha.
-
Managing Users Across Numerous Servers
Hey all, got a question. I have 6 servers that my company uses to host all of the media we use on a daily basis. We're tightening security around here, so I'm setting them up to allow each of our 80 users to admin their own passwords. Seems simple, y
-
Hi I want to use http client on the sender send and BAPI_SALESORDER_GETSTATUS on the receiver side to retrieve status from R/3. Is this scenario is feasible to work with ?? I have seen one blog on http-xi-rfc scenario. But still liket o validate with