Complex query pls help
I have a row output like this
select * from test;
s.no C1 C2 C3
1 a1 b1 x1
2 a1 b1 x2
3 a1 b1 x3
i want the output as with the new added column as like this
s.no C1 C2 C3 C4
1 a1 b1 x1 a1
2 a1 b1 x2 b1
3 a1 b1 x3 x3
pls help me in this query its urgent for the solution
Hello,
So, what is the complexity in this query? Would you like to mention from where you will get that C4 column?
-Ammad
Similar Messages
-
Hi all,
I m creating a table dynamically and after that i m inserting records in tht table dynamically..
After tht i want to fetch all the records from tht table into a cursor which is a SYS_REFCURSOR. as i have to return the data to frntend ..
But when i m opening tht cursor like
OPEN cur_GetCertDetails
FOR
SELECT TRIM(certrefno) As CertNo,
TRIM(damagedno) As Damagedno,
TRIM(personname) As Name,
TRIM(icnumber) As Icnumber,
TRIM(coursename) As CourseName,
TRIM(organiser) As Organiser,
TRIM(location) As Location,
TRIM(TO_CHAR(startdate,'DD-MON-YYYY') ||' ~ '||
TO_CHAR(enddate,'DD-MON-YYYY')) As StartEndDate
FROM ACprintInductionCert;
Its giving error as
64/5 PL/SQL: SQL Statement ignored
73/10 PL/SQL: ORA-00942: table or view does not exist
Dynamically created table name is ACprintInductionCert
Pls help me out ..
I have tried to use EXECUTE IMMEDIATE after FOR but its givin errsince your table is created dynamically, you can not
have the name hardcoded in the cursor....which is precisely the point (or one of them) I made in your Procedure Problem Urgent on this topic.
Once you start down the road of dynamic code execution it is very difficult to stop. Dynamic code has its uses but it should be very much the last resort. Dynamic code means you are literally running untested code in a production environment, and is consequently more likely to fail. Its failures are also more difficult to recover from. It also makes dependency tracking extremely difficult.
Cheers, APC -
Hi all
i am new to abap
I have the following requirement.
kindly help me how to write the select queries to achieve it.
its urgent
pls help me
thanks in advance
In June of year 1, new budget prices must be determined for the following year (year 2). The budget prices for year 2 are calculated out of the average contract prices in the first 5 months of year 1 (January May). The average contract price will then (outside the system) be corrected with an index. To calculate new prices for Campina Netherlands, a report is needed to show all materials with current budget price, volumes and contract prices during the first five months of year 1
The purchasing assistant creates an excel file per Material type, based on the Budget pricelist out of SAP.
Purchasers check the file on:
 being correct,
 materials marked for deletion in SAP
 changes to be made in data
The new prices, calculated based ion the output of the SAP Budget pricelist, are sent to controlling in june year 1.
On the 1st of January year 2 the new budget prices are inserted in SAP as the new standard price / budget price.
the fields for display are as follows
<b>table</b> <b> field<b>[/b</b>] <b> description</b>
ekko ekorg pur org
ekpo matnr mat no
makt maktx mat des
cawn zunspsc unspsc code
mbew stprs standard price
mbew peinh price unit
mara meins base unit of measure
s012 menge purchsed amount of mat
in month 1
s012 menge purchsed amount of mat
in month 2
s012 menge purchsed amount of mat
in month 3
s012 menge purchsed amount of mat
in month 4
s012 menge purchsed amount of mat
in month 5
ekpo netpr net price on date criteria 1
ekpo peinh price unit
ekpo bprme order price unit
ekpo netpr net price on date criteria 2
ekpo peinh price unit
ekpo bprme order price unit
ekpo netpr net price on date criteria 3
ekpo peinh price unit
ekpo bprme order price unit
ekpo netpr net price on date criteria 4
ekpo peinh price unit
ekpo bprme order price unit
ekpo netpr net price on date criteria 5
ekpo peinh price unit
ekpo bprme order price unitHi,
DATA: begin of i_ekpo,
menge........
netpr............
date ..........
end of i_ekpo.
Select menge netpr date
from ekpo
into table i_ekpo
where ....
if sy-subrc = 0.
LOOP AT i_ekpo.
v_month = i_ekpo-date+4(2).
CASE v_month.
WHEN '01'
itab-menge1 = i_ekpo-menge.
itab-menge5 = i_ekpo-menge.
itab-netpr1 = i_ekpo-netpr.
itab-netpr5 = i_ekpo-netpr.
WHEN '02'.
itab-menge1 = i_ekpo-menge.
itab-menge5 = i_ekpo-menge.
itab-netpr1 = i_ekpo-netpr.
itab-netpr5 = i_ekpo-netpr.
WHEN '03'.
itab-menge1 = i_ekpo-menge.
itab-menge5 = i_ekpo-menge.
itab-netpr1 = i_ekpo-netpr.
itab-netpr5 = i_ekpo-netpr.
WHEN '12'.
itab-menge1 = i_ekpo-menge.
itab-menge5 = i_ekpo-menge.
itab-netpr1 = i_ekpo-netpr.
itab-netpr5 = i_ekpo-netpr.
ENDCASE.
APPEND itab.
ENDLOOP.
Please be more specific with some sample outputs how is should be. -
Trying to form complex query - need help
I have a fairly complex query that I need to join the results of to show actual and goal by day. The actuals are an aggregation of records that get put in every day, while the targets are a single entry in range format indicating an active range for which the target applies. I'm working on a query that will put things together by month and I'm running into a snag. Can someone please point out where appropriate naming needs to go to get this to come together?
This one works:
(select DATE_INDEX, SUM(LDS) as TTLLDS, SUM(TONS) as TTLTONS from
(select DATE_INDEX, VEH_LOC, SUM(LDS) as LDS, SUM(WT) as TONS from
(select c.DATE_INDEX, c.VEH_LOC, COUNT(j.LOAD_JOB_ID) as LDS,
CASE WHEN SUM(w.SPOT_WEIGHT) = 0 THEN SUM(j.MAN_SPOT_WT)
ELSE SUM(w.SPOT_WEIGHT)
END as WT
from TC c, TC_LOAD_JOBS j, LOAD_RATES r, SPOT_WEIGHTS w
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX = w.DATE_INDEX and j.LOAD_RATE_ID = w.LOAD_RATE_ID
and c.VEH_LOC in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
group by c.DATE_INDEX, c.VEH_LOC
union
select c.DATE_INDEX, c.VEH_LOC, COUNT(j.JOB_ID) as LDS,
DECODE(SUM(j.AVG_SPOT_WEIGHT),0,SUM(r.BID_TONS),SUM(j.AVG_SPOT_WEIGHT)) as WT
from TC_3RDPARTY c, TC_3RDPARTY_JOBS j, LOAD_RATES r
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
and j.FACTORY_ID in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
group by c.DATE_INDEX, c.VEH_LOC)
group by DATE_INDEX, VEH_LOC)
group by DATE_INDEX)Now I need to add in the following query:
select (u.MACH_TPH_D+u.MACH_TPH_N)/2 as MTPH_TGT, (u.LABOR_TPH_D+u.LABOR_TPH_N)/2 as LTPH_TGT
from UTIL_TARGET_LOADERS u
where u.ORG_ID in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)The join needs to be based on VEH_LOC and DAY in the form:
... WHERE u.ORG_ID = x.VEH_LOC
AND x.DATE_INDEX between u.START_DATE and NVL(u.END_DATE,sysdate)I had one that worked just fine when only one entity was involved; the complication arises in that this is a division-level report so I have to individually resolve the subordinates and their goals before I can aggregate. This is one of two queries I need to tie together using a WITH clause so I can pivot the whole thing and present it in month-by-month fashion. When I try to tie it together like the query below, I get: invalid relational operator.
select ttls.DATE_INDEX, SUM(ttls.LDS) as TTLLDS, SUM(ttls.TONS) as TTLTONS, u.TARGET_LTPH, u.TARGET_MTPH
from UTIL_TARGET_LOADERS u,
(select DATE_INDEX, VEH_LOC, SUM(LDS) as LDS, SUM(WT) as TONS from
(select c.DATE_INDEX, c.VEH_LOC, COUNT(j.LOAD_JOB_ID) as LDS,
CASE WHEN SUM(w.SPOT_WEIGHT) = 0 THEN SUM(j.MAN_SPOT_WT)
ELSE SUM(w.SPOT_WEIGHT)
END as WT
from TC c, TC_LOAD_JOBS j, LOAD_RATES r, SPOT_WEIGHTS w
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX = w.DATE_INDEX and j.LOAD_RATE_ID = w.LOAD_RATE_ID
and c.VEH_LOC in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
group by c.DATE_INDEX, c.VEH_LOC
union
select c.DATE_INDEX, c.VEH_LOC, COUNT(j.JOB_ID) as LDS,
DECODE(SUM(j.AVG_SPOT_WEIGHT),0,SUM(r.BID_TONS),SUM(j.AVG_SPOT_WEIGHT)) as WT
from TC_3RDPARTY c, TC_3RDPARTY_JOBS j, LOAD_RATES r
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
and j.FACTORY_ID in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
group by c.DATE_INDEX, c.VEH_LOC)
group by DATE_INDEX, VEH_LOC) ttls
where ttls.DATE_INDEX beween u.START_DATE and NVL(u.END_DATE,sysdate)
and ttls.VEH_LOC = u.ORG_ID
group by ttls.DATE_INDEXI know this is a nested mess, as it has to grab the production from two tables for a range of VEH_LOC values and sum and aggregate by day and VEH_LOC, then I have to try and match that to the targets based on VEH_LOC and day. My final query is to aggregate the whole mess of sums and averages by month.
I'd appreciate it if someone can point me in the right direction.Figured it out.
select ttl.DATE_INDEX, SUM(ttl.LDS) as TTLLDS, SUM(ttl.TONS) as TTLTONS,
AVG((u.MACH_TPH_D+u.MACH_TPH_N)/2) as MTPH_TGT,
AVG((u.LABOR_TPH_D+u.LABOR_TPH_N)/2) as LTPH_TGT
from
(select DATE_INDEX, VEH_LOC, SUM(LDS) as LDS, SUM(WT) as TONS from
(select c.DATE_INDEX, c.VEH_LOC, COUNT(j.LOAD_JOB_ID) as LDS,
CASE WHEN SUM(w.SPOT_WEIGHT) = 0 THEN SUM(j.MAN_SPOT_WT)
ELSE SUM(w.SPOT_WEIGHT)
END as WT
from TC c, TC_LOAD_JOBS j, LOAD_RATES r, SPOT_WEIGHTS w
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX = w.DATE_INDEX and j.LOAD_RATE_ID = w.LOAD_RATE_ID
and c.VEH_LOC in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
group by c.DATE_INDEX, c.VEH_LOC
union
select c.DATE_INDEX, c.VEH_LOC, COUNT(j.JOB_ID) as LDS,
DECODE(SUM(j.AVG_SPOT_WEIGHT),0,SUM(r.BID_TONS),SUM(j.AVG_SPOT_WEIGHT)) as WT
from TC_3RDPARTY c, TC_3RDPARTY_JOBS j, LOAD_RATES r
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and c.DATE_INDEX between to_date('08/01/2010','MM/DD/YYYY') and to_date('07/31/2011','MM/DD/YYYY')
and j.FACTORY_ID in (select ORG_ID from ORG_ENTITIES where MNG_ORG_ID = 200)
group by c.DATE_INDEX, c.VEH_LOC)
group by DATE_INDEX, VEH_LOC) ttl, UTIL_TARGET_LOADERS u
where u.ORG_ID = ttl.VEH_LOC
and ttl.DATE_INDEX between u.START_DATE and NVL(U.END_DATE,sysdate)
group by ttl.DATE_INDEX, (u.LABOR_TPH_D+u.LABOR_TPH_N)/2 -
Error in Query (Pls help)
Hi friends,
When i executed one of the queries, i get this error:
Abort System error in program <b>CL_RSDM_READ_MASTER_DATA and form_sidval_direct</b>
Diagnosis
This internal error is a targeted termination since the program has an incorrect status.
Procedure
Analyse the situation and inform SAP.
I have check all my infoobjects and master data...everything is in active but still i dont understand why i get this....
please suggest how to get rid of this error? its urgent
Regards
BalajiHi balaji,
This can be program error, need to apply support package or correction,
seems no oss found for form_sidval_direct .....
perhaps it's sid error, try to analyze and repair the infoprovider where the query created on, use transaction RSRV.
hope this helps.
assign points if useful
Regards,
Archna -
Large number of attributes reduces data display in Query (PLS HELP).
Dear Guru's
We have newly upgraded our system to 7.0, Currently i have a Query based on master data info object(0 equipment) which contain several attributes, due to huge number of attributes, i cannot see data for few attributes( Ex:-0service descrip), but data exists for these atrrib, when i check in RSA1. my client want to use heavy number of 0Euipment numbers(nearly 10000) in selection screen. thats the reason for data not to be seen.
WE are under SP 16 also(Note 562162 - Additional selection of attribute reduces query result set is allready exists), and did not found any proper note.
So guru's can any one please tell me how i can get the data in Query for these attribute by keeping the same selection option for Equipment numbers (10000).
Dude's give me some good suggestion please...client is waiting from 1 week
Thanks in adv
Dev
Edited by: Srinivas dev on Jun 10, 2008 11:52 AMDear Yogesh,
Thanks a lot dude...
I assigned points for your kindly help....
Got any idea about by initial post Large number of attributes reduces data display in Query
Thanks and Regards
Dev -
Ok heres the table I hope u can see it...
date id citypair tail delay_minutes
1/1/2007 1 BZEIAH 466 10
1/2/2007 2 BZESJO 467 16
1/3/2007 3 BZEMIA 468 22
1/4/2007 4 BZELAX 469 21
1/5/2007 5 BZEYYZ 470 10
1/6/2007 6 BZEGUA 471 5
1/7/2007 7 BZETGU 472 8
1/8/2007 8 BZELIM 473 19
1/9/2007 9 BZEJFK 474 27
1/10/2007 10 BZEBOS 475 3
I would like to get the following, to add a new column where i get these
(all the flights that have a delay>15) / (count(id))
thank you for the help.....(all the flights that have a delay>15) / (count(id))I would understand if it was for the current id on a row, but in your case, all rows will have the same value...
How I see a logic business rule :
SQL> select * from tbl_airplane;
DT ID CITY TAIL DELAY_MIN
01/01/07 1 BZEIAH 466 100
02/01/07 1 BZEIAH 466 10
01/02/07 2 BZESJO 467 16
01/03/07 3 BZEMIA 468 22
01/04/07 4 BZELAX 469 21
01/05/07 5 BZEYYZ 470 10
01/06/07 6 BZEGUA 471 5
01/07/07 7 BZETGU 472 8
01/08/07 8 BZELIM 473 19
01/09/07 9 BZEJFK 474 27
01/10/07 10 BZEBOS 475 3
11 rows selected.
SQL> select dt, id, city, tail, delay_min,
2 count(case when delay_min>15 then 1 end) over (partition by id) / count(id) over (partition by id) avg_delay
3 from tbl_airplane ;
DT ID CITY TAIL DELAY_MIN AVG_DELAY
01/01/07 1 BZEIAH 466 100 ,5
02/01/07 1 BZEIAH 466 10 ,5
01/02/07 2 BZESJO 467 16 1
01/03/07 3 BZEMIA 468 22 1
01/04/07 4 BZELAX 469 21 1
01/05/07 5 BZEYYZ 470 10 0
01/06/07 6 BZEGUA 471 5 0
01/07/07 7 BZETGU 472 8 0
01/08/07 8 BZELIM 473 19 1
01/09/07 9 BZEJFK 474 27 1
01/10/07 10 BZEBOS 475 3 0
11 rows selected.
SQL> Nicolas. -
Newbie query .Pls help!!!
Hii
All,
i have started using java very recently.Now for a forthcoming project in jsp/servlet i am trying to install necessary things.
my os :windows 2000(prof).
java :jdk1.4
servelet --jsdk2.0
tomcat :jakarta-tomcat3.2.3
Tomcat is installed by unpacking the tar file.
i have compiled normal java files and also that using servlet classes successfully.
i have set the classpath from my computer -->properties-->advancec-->environment variables as follows
classpath =C:\jdk1.4\bin;C:\jdk1.4\lib;C:\JSDK2.0\lib\jsdk.jar;C:\jdk1.4\lib\tools.jar;C:\jakarta-tomcat-3.2.3
JAVA_HOME=C:\jdk1.4
SERVLET_HOME=C:\JSDK2.0
TOMCAT_HOME=C:\jakarta-tomcat-3.2.3
NOW I AM GETTING THE FOLLOWING ERRORS IN TWO CASES :
1. when i am trying to run servletrunner i am getting the following output:
C:\JSDK2.0\bin>servletrunner
servletrunner starting with settings:
port = 8080
backlog = 50
max handlers = 100
timeout = 5000
servlet dir = .\examples
document dir = .\examples
servlet propfile = .\examples\servlet.properties
java.net.BindException: Address in use: bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at sun.servlet.http.HttpServer.run(HttpServer.java:222)
at sun.servlet.http.HttpServer.main(HttpServer.java:432)
there is no IIS running in my pc .
2) when i am trying to browse a jsp page in tomcat (even the example .jsp pages given with tomcat) ,i am getting the following errors:
Error: 500
Location: /examples/jsp/num/numguess.jsp
Internal Servlet Error:
java.lang.NoSuchMethodError: javax.servlet.ServletException.getRootCause()Ljava/lang/Throwable;
at org.apache.tomcat.context.ExceptionHandler.doService(DefaultCMSetter.java:289)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.handleError(ContextManager.java:1183)
at org.apache.tomcat.core.Handler.service(Handler.java:312)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:579)
please help me to sort out these problem .
regards
Arnabhii
in addition to what i hav written earliar ,i would like to add over here the error i am getting while executing the startup.bat file
C:\jakarta-tomcat-4.1.24-LE-jdk14\bin>startup
Using CATALINA_BASE: C:\jakarta-tomcat-4.1.24-LE-jdk14
Using CATALINA_HOME: C:\jakarta-tomcat-4.1.24-LE-jdk14
Using CATALINA_TMPDIR: C:\jakarta-tomcat-4.1.24-LE-jdk14\temp
Using JAVA_HOME: C:\jdk1.4
java.lang.NoSuchMethodError: java.util.logging.Logger.logp(Ljava/util/logging/Le
vel;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
at org.apache.commons.logging.impl.Jdk14Logger.log(Jdk14Logger.java:126)
at org.apache.commons.logging.impl.Jdk14Logger.info(Jdk14Logger.java:192
at org.apache.commons.modeler.Registry.loadRegistry(Registry.java:264)
at org.apache.catalina.mbeans.MBeanUtils.createRegistry(MBeanUtils.java:
1702)
at org.apache.catalina.mbeans.MBeanUtils.<clinit>(MBeanUtils.java:163)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.<clinit>(
GlobalResourcesLifecycleListener.java:117)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:33)
at sun.reflect.InflatableConstructorAccessorImpl.newInstance(InflatableC
onstructorAccessorImpl.java:38)
at java.lang.reflect.Constructor.newInstance(Constructor.java:273)
at java.lang.Class.newInstance0(Class.java:290)
at java.lang.Class.newInstance(Class.java:249)
at org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.j
ava:253)
at org.apache.commons.digester.Rule.begin(Rule.java:200)
at org.apache.commons.digester.Digester.startElement(Digester.java:1268)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1452)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1717)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1469)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
at org.apache.commons.digester.Digester.parse(Digester.java:1543)
at org.apache.catalina.startup.Catalina.start(Catalina.java:449)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:30)
at sun.reflect.InflatableMethodAccessorImpl.invoke(InflatableMethodAcces
sorImpl.java:48)
at java.lang.reflect.Method.invoke(Method.java:306)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
any further suggestions upon this post will be gr8ly appreciated
regards
arnab -
SQL query...pls help ASAP
Actor (Aname: varchar(40), Ano: varchar(6)) Ano is pk
Movie (Mname: varchar(40),mno: varchar(8)) Mno is pk
PlayIn (Ano, Mno, Pay: Integer) Ano and Mno are fk referencing Acotr and Movie respectively.
Actor(Aname, Ano)
A Bingo, A1
B Castro, A2
C Katie, A3
S Hommy, A4
J Tammy, A5
K loren, A6
Movie(Mname, Mno)
Gladiator, M1
Cast, M2
Dog, M3
Jilters, M4
PlayIn(Ano,Mno,Pay)
A1 M1 800
A1 M2 1500
A2 M2 78
A2 M3 1750
A2 M4 2301
A3 M2 904
A3 M3 629
A4 M2 565
A4 M3 5695
A4 M4 1255
A5 M1 989
A5 M4 238
A6 M2 137
A6 M3 236
A6 M4 545
QUESTION: write SQL query to find the names of actors who earned less than 'B Castro' in each movie that 'B Castro' played in.thanks so so much.....
another question:
for each movie, list the movie number, the average
pay and the total number of actors in the movie.....Rather than just asking homework questions and expecting everyone else to do your work for you, why don't you at least have a go at it yourself and post the query that you've tried, then we'll tell you where you are going wrong. You won't learn anything if we just write it for you.
Also, your use of "pls help ASAP" in the subject title is not polite.
This forum is manned by volunteers who have their own jobs and offer their help free of charge.
Everyone who posts an issue on here would love to have it answered as soon as possible, but nobody has the right to assume that their issue is any more important, urgent or requires a quicker answer than anybody elses.
If you need urgent help then you should pay someone to do the work for you. -
Dear Friends
Here is my query on Background processing,
I want to run a program in background which ll save the details in AL11.
I want to schedule this object between 12 AM night to 2 AM night as per the indian time standard.
The data should be save the data in al11 as the following format=>
1-It ll show the PO details that has been created between 12-1 and 1-2,it should not show 12-1 data in 1-2 means between 12 to 2 i ll store the data in AL11 that has been created between these one hour time if it would more than one hour than last one hour data it wont show in al11.
Now the Pos that has been created between 2 am to next day night should be display when the user ll run the report at next day 12 o'clock.
Can you give me the following idea,
1-Which table stores the background scheduling time,if NAST than what is the field name.
If anyone solve this kind of prob,pls help me on this.
Thanks a lot
mrutyun^Hi,
Try table<b> TBTCS</b> which stores Background Processing: Time Schedule.
Regards,
Amit -
Consecutive Absent Days Query.. Pls Help Gurus
I have a table which stores attendance information
For eg:
Emp_No Date
100 01-APR-2010
102 05-APR-2010
100 02-APR-2010
I need a query with parameter From Date and To date..
My Query Output should be like this .. considering that employee 100 is absent for 8 consecutive days and employee number 102 is absent for 2 consecutive days..
It should return number of consecutive days he is absent.
Empno Consecutive Days
100 8 Days
102 2 Days
Pls Help Gurus.
Edited by: suzvino on Jun 21, 2010 12:14 AMTUBBY_TUBBZ?with data as
2 (
3 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
4 select 102 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
5 select 100 as emp_no, to_date('02-APR-2010','dd-mon-yyyy') as absent_date from dual union all
6 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
7 select 100 as emp_no, to_date('03-APR-2010','dd-mon-yyyy') as absent_date from dual union all
8 select 100 as emp_no, to_date('04-APR-2010','dd-mon-yyyy') as absent_date from dual union all
9 select 100 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
10 select 100 as emp_no, to_date('06-APR-2010','dd-mon-yyyy') as absent_date from dual union all
11 select 100 as emp_no, to_date('07-APR-2010','dd-mon-yyyy') as absent_date from dual union all
12 select 100 as emp_no, to_date('08-APR-2010','dd-mon-yyyy') as absent_date from dual union all
13 select 100 as emp_no, to_date('09-APR-2010','dd-mon-yyyy') as absent_date from dual
14 )
15 select
16 emp_no, max(level)
17 from data
18 connect by prior emp_no = emp_no and prior absent_date = absent_date - 1
19 group by emp_no
20 having max(level) >= 8;
EMP_NO MAX(LEVEL)
100 9
1 row selected.
Elapsed: 00:00:00.01
TUBBY_TUBBZ?Think i misread the post, so the query should be
TUBBY_TUBBZ?with data as
2 (
3 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
4 select 102 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
5 select 100 as emp_no, to_date('02-APR-2010','dd-mon-yyyy') as absent_date from dual union all
6 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
7 select 100 as emp_no, to_date('03-APR-2010','dd-mon-yyyy') as absent_date from dual union all
8 select 100 as emp_no, to_date('04-APR-2010','dd-mon-yyyy') as absent_date from dual union all
9 select 100 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
10 select 100 as emp_no, to_date('06-APR-2010','dd-mon-yyyy') as absent_date from dual union all
11 select 100 as emp_no, to_date('07-APR-2010','dd-mon-yyyy') as absent_date from dual union all
12 select 100 as emp_no, to_date('08-APR-2010','dd-mon-yyyy') as absent_date from dual union all
13 select 100 as emp_no, to_date('09-APR-2010','dd-mon-yyyy') as absent_date from dual
14 )
15 select
16 emp_no, max(level)
17 from data
18 connect by prior emp_no = emp_no and prior absent_date = absent_date - 1
19 group by emp_no;
EMP_NO MAX(LEVEL)
100 9
102 1
2 rows selected.
Elapsed: 00:00:00.01Edited by: Tubby on May 30, 2010 11:00 PM
Added second query since i misread the post originally. -
How is the design for this complex requirement ? pls help..
Hi All,
We have a Discount scheme that can be given for all possible
combination of all customer, area and product hierarchy (attached below).
for example :
Promotion No.001 =>for sales on : CustomerGroup 'A', Area 'B', and
ProductBrand 'C' will get discount 2 %
Promotion No.002 =>for sales on : AllCustomer, District 'D', and
Product 'E' will get discount 2.5 %
Promotion No.003 =>for sales on : CustomerType 'F', AllArea, and
ProductGroup 'G' will get discount 3 %
... and any possible combination.
And it is possible for an Order / Invoice to get discount from two or
more different promotion.
e.g: Order 001, get 2 % from Promotion No.001 and 3 % from Promotion
No.003, so totally it gets 5% discount.
(1) Customer Hierarchy
AllCustomer
CustomerGroup
CustomerType
Customer
(2) Area Hierarchy
AllArea
Region
District
Area
(3) Product Hierarchy
AllProduct
ProductGroup
ProductBrand
Product
Our Orders Data has following attributes :
OrderNo.
Customer
Area
Product
Gross
Discount
Additional info :
- Oracle version : 10g
- If multiple discounts are applied, e.g: two discount, 10% each, then
the total discount is 20%, if gross = 100, then netto is 100 * 80% =
80.
The design that comes to my mind is like below, please give me
correcttion and recommendation :
The Promotions is defined in master-detail :
- one master table
- three detail tables (one for each possible hierarchy)
- one additional Tabel to store detail of discount an Order get,
because it can get 2 or more discount.
PromoHeader :
- PromoNumber
- Description
- StartDate
PromoDetail1 :
- PromoNumber
- PType (ALL / CustomerGroup / CustomerType / Customer)
- PCode (ALL / 'xxxx' )
( note : 'xxxx' can be Customer Group Code, Customer Type Code or
Customer Code )
PromoDetail2 :
- PromoNumber
- PType (ALL / Region / District / Area)
- PCode (ALL / 'xxxx' )
( note : 'xxxx' can be Region Code, District Code or Area Code )
PromoDetail3 :
- PromoNumber
- PType (ALL / ProductGroup / ProductBrand / Product)
- PCode (ALL / 'xxxx' )
( note : 'xxxx' can be ProductGroup Code, ProductBrand Code, Product
Code )
PromoByOrder
- OrderNumber
- PromoNumber
- PType
- PCode
- Discount (%)
(if an Order get two discount, there will be two records on this table
for thet order)
The question is :
1) is this a 'good enough' design ?
2) if I do go with this design, how is the efficient query / plsql to
calculate the discounts for an Order.
Pls help..
Thank you very much,
xtantoHow was your wife using the Find My iPhone app from a Samsung phone? But, that question aside, your wife should educate herself on how GPS works, especially on a cell phone. GPS signals can be interfered with by trees, buildings, clouds. Off by several miles would be unusual, though.
If your wife is tracking your cell phone and not believing what you tell her, you may want to consider counseling as there are some very serious issues that go way beyond the technology.
Best of luck. -
Query-Automatic assignment of Record type to Book of Business-Pls help me
I have a query about Automatic assignment of record in Book of Business.
Using 5 record types & 50 regions as a part of Book of Business. You can say 50 sub-books.
I want to assign these 5 record type to particular Book when to create & modify.
Eg. When I create new account it should be automatically assigned to Book 1 & later I modify this account for reassignment to new user then it should be automatically added to the new user’s book.
I need to create workflow for this as Assign to book criteria for both when new record saved & when modified record saved.
I have tried this & its working; however problem is with the creation of two many workflows.
50 region (Books) x 5 record types * 2 - Create/modify flow = 500 workflows for one country!
If I am right then I can assign 1 record type with action as create or modify in 1 book only.
How to reduce these no. of workflows?
Pls help me out in this regard.
Regards
MangeshMangesh,
I am sorry to tell you that there is no quick answer to this but i will say that maybe you need to rethink your book structure and their requirements here.
I have 4 types and 7 regions so you need to create books to allocate all these on create and also modify. Customers have raised concerns with this to Oracle and they are looking into it but they are along way from completing this. Sorry to spoil your day but i would strongly ask you to consider your books structure before you complete this.
Otherwise if you are using webservices you could assisgn the book when the record is piped into the CRM and then you only need to complete the modify workflows. -
QUERY CLARIFICATION RQD : gurus, experts pls help
Hai,
I am facing problem in performance of the query. sample scenario i have created here pls help me to solve
**VEH_MAIN* TABLE (MASTER TABLE)*
CREATE TABLE VEH_MAIN
( VIP_MOT_IND VARCHAR2(10 BYTE),
VIP_IND NUMBER(10,0)
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',1);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT02',5);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('M0T03',1);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',2);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT02',6);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',3);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',4);
**VEH_ENGINE_SUB* (table for engine subclass)*
CREATE TABLE VEH_ENG_SUB
( ENG_SUBCLASS VARCHAR2(50 BYTE),
ENG_MOT_IND VARCHAR2(10 BYTE)
Insert into VEH_ENG_SUB (ENG_SUBCLASS,ENG_MOT_IND) values ('ENGSUB001','MOT01');
Insert into VEH_ENG_SUB (ENG_SUBCLASS,ENG_MOT_IND) values ('ENGSUB001','MOT02');
*VEH_ENG_IND( Detail table for engine subclass)*
CREATE TABLE VEH_ENG_IND
( "ENG_SUBCLASS" VARCHAR2(50 BYTE),
"ENG_IND" VARCHAR2(10 BYTE)
Insert into VEH_ENG_IND (ENG_SUBCLASS,ENG_IND) values ('ENGSUB001','1');
Insert into VEH_ENG_IND (ENG_SUBCLASS,ENG_IND) values ('ENGSUB001','2');
*VEH_AXIS( Master table for Engine Axis)*
CREATE TABLE VEH_AXIS
( ENG_AXIS VARCHAR2(50 BYTE),
AXIS_MOT_IND VARCHAR2(10 BYTE)
Insert into VEH_AXIS (ENG_AXIS,AXIS_MOT_IND) values ('ENGAXIS001','MOT01');
Insert into VEH_AXIS (ENG_AXIS,AXIS_MOT_IND) values ('ENGAXIS002','MOT02');
*VEH_AXIS_IND( Details table for engine axis)*
CREATE TABLE VEH_AXIS_IND
( ENG_AXIS VARCHAR2(50 BYTE),
ENG_IND VARCHAR2(10 BYTE)
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','1');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','2');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','3');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','4');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS002','5');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS002','6');
Condition 1
if i select only ENGINE_SUBCLASS='ENGSUB001' then
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )output is
MOT01 1
MOT01 2
Condition 2:if i select only the Engine Axis='ENGAXIS002' then the
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_axis vaxis,
veh_axis_ind vaind
WHERE v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002';MOT02 5
MOT02 6
Condition 3:
BOTH ENGINE AXIS AND ENGINE SUBCLASS
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind,
veh_axis vaxis,
veh_axis_ind vaind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )
AND ( v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002');Null values returned. this is correct.
But the query PERFORMANCE fails in OR CONDITON as below
Condition 4;
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind,
veh_axis vaxis,
veh_axis_ind vaind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )
OR ( v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002');output
MOT02 5
MOT02 5
MOT02 5
MOT02 5
MOT02 6
MOT02 6
MOT02 6
MOT02 6
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
This is sample example. when i implement in huge table with partition this scennario takes much time even 2 hours to run.
i want the output must be as below if i use OR condition like condition 4
MOT01 1
MOT01 2
MOT02 5
MOT02 6
Gurus and experts pls help me to solve this problem. Dont give any suggestion like
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_axis vaxis,
veh_axis_ind vaind
WHERE v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002'
union
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )
}this will give correct result...
MOT01 1
MOT01 2
MOT02 5
MOT02 6
but the problem is we cannot implement this in query. because query get framed at runtime there will be so many implement has to be done. other than UNION pls give me more suggesion
waiting..
S
Edited by: A Beginner on Sep 11, 2010 12:51 AMcreate a view v1 with all the joins
select * from v1 where eng_subclass='ENGSUB001'
union
select * from v1 where eng_axis='ENGAXIS002'
If you really do not like the direct access with union, try this
select * from v1
where vsub_PK in (select vsub_PK from v1 where eng_subclass='ENGSUB001' )
OR vsub_PK in (select vsub_PK from v1 where eng_axis='ENGAXIS002')
--vsub_PK is the primary key of table vsub -
Hi,
I've needed to print output like below. pls help me out .
Thanks & Regards,
Ramana.SQL> select '*****'||chr(10)||'****'||chr(10)||'***'||chr(10)||'**'||chr(10)||'*' from dual;
'*****'||CHR(10)||'
SQL>
Maybe you are looking for
-
HT4108 iPod doesn't work with av adapter
I have an iPod Touch 4G, os 5.1.1. I am trying to play a video from my iPod on a tv via an apple AV cable but for some reason it does not work. I've tried to connect my iPad and and the iPad works without a problem. So how can I fix my iPod?
-
How to stop the guesswork with printing business cards
Hello everyone, when I print business cards I use one of those 10 blank business cards per sheet paper. I scan the image of the blank business card template, then I import to Illustrator and then I make the business cards. The problem is when I print
-
Powerpoint graphic export filters
Hi guys; I'm using Java to Com bridge technology for ppt automation to export a ppt presentation's slides as GIF images. the issue here is wether PowerPoint graphic export filters are always Installed with ppt. what if my program can't find GIF graph
-
When attempting to install OS X Mountain Lion I get the following error message "We could not complete your purchase. OS X Mountain Lion is not compatible with this computer." Any idea what the issue might be?
-
Has anyone experienced trouble with the "date added" date? I have purchased songs from iTunes as well as imported from a CD, and have had the items show up in iTunes with an incorrect date. This is causing issues with creating smart playlist. Any hel