With separate SQL query and the counter is wrong.
HelloI have another problem with a query.
The following data:
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
CREATE TABLE TABLE_1
( "ORDER_NR" VARCHAR2 (12)
, "PRIORITY" VARCHAR2 (2)
, "WO_STATUS" VARCHAR2 (1)
, "STATUS_DATE" DATE
, "ART_NR" VARCHAR2 (9)
, "DESCRIPTION" VARCHAR2 (255)
, "PRICE" VARCHAR2 (10)
);
CREATE TABLE TABLE_2
( "ART_NR" VARCHAR(9)
, "MODELL" VARCHAR2(10)
, "MANUFACT" VARCHAR2(20)
);
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300612', '12', 'U', TO_DATE('05-FEB-13 10:22:39','DD-MON-RR HH24:MI:SS'), '005231987', '1ST ANNUAL SERVICE', '5000.2546');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300638', '05', 'U', TO_DATE('05-FEB-13 11:38:39','DD-MON-RR HH24:MI:SS'), '005667821', '3RD ANNUAL SERVICE', '5269.7856');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300638', '12', 'U', TO_DATE('06-FEB-13 12:38:39','DD-MON-RR HH24:MI:SS'), '005667821', '1ST BIENNIAL SERVICE', '1234.4468');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300638', '12', 'U', TO_DATE('07-FEB-13 13:38:39','DD-MON-RR HH24:MI:SS'), '005667821', '3RD ANNUAL SERVICE', '4366.7856');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300762', '12', 'U', TO_DATE('22-FEB-13 14:55:48','DD-MON-RR HH24:MI:SS'), '018743356', '3RD ANNUAL SERVICE', '4462.8632');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300766', '12', 'U', TO_DATE('22-FEB-13 08:32:13','DD-MON-RR HH24:MI:SS'), '018743356', '2ND ANNUAL SERVICE', '8762.6643');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300766', '05', 'U', TO_DATE('23-FEB-13 12:32:13','DD-MON-RR HH24:MI:SS'), '018743356', '1ST BIENNIAL SERVICE', '3425.6643');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300766', '12', 'U', TO_DATE('24-FEB-13 14:32:13','DD-MON-RR HH24:MI:SS'), '018743356', '2ND BIENNIAL SERVICE', '6678.6643');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300612', '12', 'U', TO_DATE('06-FEB-13 10:22:39','DD-MON-RR HH24:MI:SS'), '005231987', '1ST ANNUAL SERVICE', '5000.2546');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300638', '05', 'U', TO_DATE('05-FEB-13 11:38:39','DD-MON-RR HH24:MI:SS'), '005667821', '3RD ANNUAL SERVICE', '5269.7856');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300638', '12', 'U', TO_DATE('06-FEB-13 12:38:39','DD-MON-RR HH24:MI:SS'), '005667821', '1ST BIENNIAL SERVICE', '1234.4468');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300638', '12', 'U', TO_DATE('07-FEB-13 13:38:39','DD-MON-RR HH24:MI:SS'), '005667821', '3RD ANNUAL SERVICE', '4366.7856');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300762', '12', 'U', TO_DATE('22-FEB-13 14:55:48','DD-MON-RR HH24:MI:SS'), '018743356', '3RD ANNUAL SERVICE', '4462.8632');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300766', '12', 'U', TO_DATE('22-FEB-13 08:32:13','DD-MON-RR HH24:MI:SS'), '018743356', '2ND ANNUAL SERVICE', '8762.6643');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300766', '05', 'U', TO_DATE('23-FEB-13 12:32:13','DD-MON-RR HH24:MI:SS'), '018743356', '1ST BIENNIAL SERVICE', '3425.6643');
INSERT INTO TABLE_1 (ORDER_NR, PRIORITY, WO_STATUS, STATUS_DATE, ART_NR, DESCRIPTION, PRICE)
VALUES ('1KKA1Z300766', '12', 'U', TO_DATE('24-FEB-13 14:32:13','DD-MON-RR HH24:MI:SS'), '018743356', '2ND BIENNIAL SERVICE', '6678.6643');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT1');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT2');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT3');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT4');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT5');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT6');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005667821', 'LASER', 'MANUFACT1');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005667821', 'LASER', 'MANUFACT2');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005667821', 'LASER', 'MANUFACT3');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005667821', 'LASER', 'MANUFACT4');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT1');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT2');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT3');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT4');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT5');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT6');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT1');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT2');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT3');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT4');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT5');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005231987', 'X-RAY1', 'MANUFACT6');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005667821', 'LASER', 'MANUFACT1');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005667821', 'LASER', 'MANUFACT2');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005667821', 'LASER', 'MANUFACT3');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('005667821', 'LASER', 'MANUFACT4');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT1');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT2');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT3');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT4');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT5');
INSERT INTO TABLE_2 (ART_NR, MODELL, MANUFACT)
VALUES ('018743356', 'VACCUM', 'MANUFACT6');
COMMIT;
And my request:SELECT T1.ART_NR
, T2.MODELL
, SUM(ROUND(T1.PRICE, 2)) AS TOTAL_PRICE
, COUNT(*) AS QTY
, TO_CHAR(T1.STATUS_DATE, 'MON-RR') AS MONTH
FROM TABLE_1 T1, TABLE_2 T2
WHERE T1.WO_STATUS = 'U'
AND T1.ART_NR = T2.ART_NR
AND TO_CHAR(T1.STATUS_DATE, 'MON-RR') = 'FEB-13'
GROUP BY T2.MODELL
, T1.ART_NR
, TO_CHAR(T1.STATUS_DATE, 'MON-RR')
And the result:ART_NR MODELL TOTAL_PRICE QTY MONTH
--------- ---------- ----------- ---------- ------
018743356 VACCUM 559916.16 96 FEB-13
005667821 LASER 173936.48 48 FEB-13
005231987 X-RAY1 120006 24 FEB-13
My problem now is the OTY ist wrong field should count how many times the equipment was in service in Feb - 13 and group them by "MODEL" the production area is not interesting to me, but this is my problem, a model can have several Manufacter and so I had a bad count for my Qty.The next step that I need is to group the result also by type of Service (annual or biannual), like this:
ART_NR MODELL TOTAL_PRICE QTY MONTH SERVICE_TYPE
--------- ---------- ----------- ---------- ------ ---------------------
018743356 VACCUM 1234.56 4 FEB-13 ANNUAL
018743356 VACCUM 4423.48 10 FEB-13 BIENNIAL
005667821 LASER 4783.11 2 FEB-13 ANNUAL
005667821 LASER 1123.77 22 FEB-13 BIENNIAL
005231987 X-RAY1 8966.12 6 FEB-13 ANNUAL
005231987 X-RAY1 7826.44 12 FEB-13 BIENNIAL
These values are only out of my head, not the table, just to show what I need.Thanks for your help.
Hosts Reinhard
Hello
990524 wrote:
HelloWow it's great.
Thanks Frank.In my database, this query works like a charm, but I have a problem, sometimes the round command do not work then I get a total price of 1231.0000000000001, I
tried of TRUNCATES the value, but it's always the same value.
Sorry, I can not re - create the problem.
And I put another line in the query that calculates the average price per model:
, ROUND ( SUM (g.price) / COUNT(*) ,2 ) AS average
Why not just
, ROUND (AVG (g.price), 2) AS average
?
and in this line, I have the same problem with bad ROUNDS.
Do you have an idea in this case?
No, sorry. If I can't get the same behavior, myself, it is not that I do.
Instead of ROUND, you can use TO_CHAR to (for example) display 2 digits after the decimal point. To_char will automatically round the result. Your front end (for example, the SQL * Plus COLUMN...) FORMAT command) can probably do the same thing.
Tags: Database
Similar Questions
-
Help with making SQL query references to column aliases in the Case statement
I need help with a sql query that I'm trying. I can go about it the wrong way, but I would be grateful if I could get any suggestions on possible solutions. This is my query:
SELECT DISTINCT spriden_pidm, spriden_id id, spriden_last_name | ',' | spriden_first_name name,
CASE
WHEN rcresar_comm_code_01 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_01
WHEN rcresar_comm_code_02 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_02
WHEN rcresar_comm_code_03 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_03
WHEN rcresar_comm_code_04 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_04
WHEN rcresar_comm_code_05 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_05
WHEN rcresar_comm_code_06 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_06
WHEN rcresar_comm_code_07 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_07
WHEN rcresar_comm_code_08 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_08
WHEN rcresar_comm_code_09 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_09
WHEN rcresar_comm_code_10 IN ('268 ', '269', ' 270') THEN rcresar_comm_code_10
END acg_elig_comm_code
CASE
WHEN acg_elig_comm_code = ' 268' THEN 'rigorous HS course. "
WHEN acg_elig_comm_code = '269' THEN ' 2 or several AP or IB"
WHEN acg_elig_comm_code = '270' THEN 'NOC as possible ".
END comm_code_description
OF spriden, rcresar, rcrapp1
WHERE (rcresar_comm_code_01 IN ('268 ', '269', ' 270')
OR rcresar_comm_code_02 ('268 ', '269', ' 270')
OR rcresar_comm_code_03 ('268 ', '269', ' 270')
OR rcresar_comm_code_04 ('268 ', '269', ' 270')
OR rcresar_comm_code_05 ('268 ', '269', ' 270')
OR rcresar_comm_code_06 ('268 ', '269', ' 270')
OR rcresar_comm_code_07 ('268 ', '269', ' 270')
OR rcresar_comm_code_08 ('268 ', '269', ' 270')
OR rcresar_comm_code_09 ('268 ', '269', ' 270')
OR rcresar_comm_code_10 ('268 ', '269', ' 270'))
Rcresar_aidy_code = & aidy_code
AND rcrapp1_aidy_code = rcresar_aidy_code
AND rcrapp1_curr_rec_ind = 'Y '.
AND rcrapp1_seq_no = rcresar_seq_no
AND spriden_pidm = rcresar_pidm
AND rcrapp1_pidm = rcresar_pidm
AND spriden_change_ind IS NULL
ORDER BY name
The second case statement is where I don't know exactly what it takes to get what I want.
Output should be like:
spriden_pidm name ID acg_elig_comm_code comm_code_description
«0000000000', ' 1111111111 ","John Doe","268", «rigorous HS race"»
If I take the second case statement it works great except that I do not have my comm_code description column. My question is how can I use my first statement value box to determine this column? I think that I need a case statement as I have, but I don't know how to reference the value of acg_elig_comm_code. Any help would be greatly appreciated. Thank you.
Published by: blackhole82 on January 20, 2009 09:20Hello
You cannot use the alias column in the query, even where it is set (except in the ORDER BY clause).
You can set the alias in a subquery and then use it in a great query, like this:WITH sub_q AS ( SELECT DISTINCT spriden_pidm,spriden_id id, spriden_last_name||', '||spriden_first_name name, CASE WHEN rcresar_comm_code_01 IN ('268','269','270') THEN rcresar_comm_code_01 WHEN rcresar_comm_code_02 IN ('268','269','270') THEN rcresar_comm_code_02 WHEN rcresar_comm_code_03 IN ('268','269','270') THEN rcresar_comm_code_03 WHEN rcresar_comm_code_04 IN ('268','269','270') THEN rcresar_comm_code_04 WHEN rcresar_comm_code_05 IN ('268','269','270') THEN rcresar_comm_code_05 WHEN rcresar_comm_code_06 IN ('268','269','270') THEN rcresar_comm_code_06 WHEN rcresar_comm_code_07 IN ('268','269','270') THEN rcresar_comm_code_07 WHEN rcresar_comm_code_08 IN ('268','269','270') THEN rcresar_comm_code_08 WHEN rcresar_comm_code_09 IN ('268','269','270') THEN rcresar_comm_code_09 WHEN rcresar_comm_code_10 IN ('268','269','270') THEN rcresar_comm_code_10 END acg_elig_comm_code -- Originally posted with , here (error) FROM spriden, rcresar, rcrapp1 WHERE (rcresar_comm_code_01 IN ('268','269','270') OR rcresar_comm_code_02 IN ('268','269','270') OR rcresar_comm_code_03 IN ('268','269','270') OR rcresar_comm_code_04 IN ('268','269','270') OR rcresar_comm_code_05 IN ('268','269','270') OR rcresar_comm_code_06 IN ('268','269','270') OR rcresar_comm_code_07 IN ('268','269','270') OR rcresar_comm_code_08 IN ('268','269','270') OR rcresar_comm_code_09 IN ('268','269','270') OR rcresar_comm_code_10 IN ('268','269','270')) AND rcresar_aidy_code = &aidy_code AND rcrapp1_aidy_code = rcresar_aidy_code AND rcrapp1_curr_rec_ind = 'Y' AND rcrapp1_seq_no = rcresar_seq_no AND spriden_pidm = rcresar_pidm AND rcrapp1_pidm = rcresar_pidm AND spriden_change_ind IS NULL ) SELECT sub_q.*, CASE WHEN acg_elig_comm_code = '268' THEN 'Rigorous HS course' WHEN acg_elig_comm_code = '269' THEN '2 or more AP or IB' WHEN acg_elig_comm_code = '270' THEN 'ACG possible' END comm_code_description FROM sub_q ORDER BY name
Furthermore, you might think to rearrange your table, so that you do not have 10 columns (rcresar_comm_code_01, rcresar_comm_code_02,...) that essentially do the same thing. The usual way to handle this kind of one-to-many relationship is to have all rcresar_comm_codes in a separate table, one per line, with a pointer to the table where you have them now.
Published by: Frank Kulash, January 20, 2009 11:35
Syntax error has been corrected -
In the Photos of El Capitan how to record a double published in a separate with its own name and the ID file file?
Only by exporting - with Photos (and iPhoto and Aperture) - you can have several versions of an image by duplicating the image (control - D), but this does not create an image file separated until you export - it creates a separate edit list in the database that applies to the original when you watch or export the photos
Photos as it were its predecessors is a non-destructive control Digital Asset Manager (DAM) which does not any changes to files in the database but built a list of validation
LN
-
Hello
I have a data in table (raj_table) with columns (char11) raj_id, raj_number (varchar2 (15)), raj_format (NUMBER), Primary_ID (identity with the values of the primary key column)
Primary_ID raj_id Raj_number Raj_format
1 raj rajvend 1
2 raj rajvend 1
3 raj rajvendor1 2
4 raj rajvendor1 2
5 raj rajvendor1 2
6 raj rajvendor2 3
I used under SQL to get query output as below, but has not achieved the required result:
Select client_id vendor_number, vendor_format, primary_id, row_number() on sl_no (client_id partition, primary_id, vendor_format order of client_id primary_id, vendor_format, vendor_number, vendor_number)
from raj_table by sl_no asc
SL_NO raj_id raj_number raj_format primary_id
1 1 raj rajvendor 1
1 2 raj rajvendor 1
2 3 raj rajvendor1 2
2 4 raj rajvendor1 2
2 5 raj rajvendor1 2
3 6 raj rajvendor2 3
I need help with a SQL query to get the result as above without using the group by clause. I want to bring together the combination of separate line of the three columns (raj_id, raj_number, raj_format) and add a unique serial number for each online game (SL_NO column below). So, above there are 3 unique set of (raj_id, raj_number, raj_format) I can get in a group by clause, but I can not add prmiary_id, SL_NO values if I group by clause. I used the analytical functions like row_number() but no luck. Need solution for this.
with t as)
Select 'raj' raj_id, 'rajvend' raj_number, 1 raj_format, 1 primary_id Union double all the
Select option 2, 'raj', 'rajvend', 1 double Union all
Select 3, 'raj', 'rajvendor1', 2 double Union all
Select 4, 'raj', 'rajvendor1', 2 double Union all
Select 5, 'raj', 'rajvendor1', 2 double Union all
Select 6, 'raj', 'rajvendor2', 3 double
)
Select dense_rank() over (order of raj_id, raj_number, raj_format) sl_no,
t.*
t
order by primary_id
/
PRIMARY_ID RAJ RAJ_NUMBER RAJ_FORMAT SL_NO
---------- ---------- --- ---------- ----------
1 1 raj rajvend 1
1 2 raj rajvend 1
2 3 raj rajvendor1 2
2 4 raj rajvendor1 2
2 5 raj rajvendor1 2
3 6 raj rajvendor2 36 selected lines.
SQL >
SY.
-
SQL query for the mapping of a set of prizes to a group of classrooms
Hi all
I use Oracle database 11g Release 2.
I have the following data set:
Classrooms
ClassId ClassName ability group
------ ---------------------------------------------- -------------- -----------
Babbage/software Engg Lab 1 24 1
Basement 2 - block PG 63 1
3 1 56 1 class
Class 4 1 24 10
Class 5 1 24 11
Class 6 1 35 12
7 13 42 1 class
8 14 42 1 class
9 15 42 1 class
10 2 35 1 class
11 3 35 1 class
12 4 35 1 classroom
13 5 35 1 class
14 6 25 1 class
15 7 25 1 class
16 1 24 8 class
17 9 24 1 class
18 control Sys Lab 1 24
19 dig & Embd Sys Lab 20 1
20 PSD & Comm 20 1 Lab
21 electromechanical system Lab 28 1
Farabi 22/Web Tech Lab 1 36
23 gen purpose Lab 40 1
Shirazi/24dB Tech Lab 1 36
ADV 25 elect Lab 30 2
26 16 42 2 class
27 17 49 2 class
28 18 56 2 class
29 19 42 2 class
30 20 49 2 class
Class 31 21 35 3
32 22 35 3 class
33 20 3 MDA lab
DegreeBatches
BatchId BatchName force
--------------- ----------------------- --------------
1 BIT - 11 79
2 BIT - 12 28
3 BS (CS)-1 35
4 BS (CS) 78-2
5 BE (SE)-1 69
6. BE (SE) 84-2
7 BE (SE) 64-3
8 84 BYTČA-7
9 43 BYTČA-8
BEE-1 10, 112
11 151 BEE-2
BEE-3 12, 157
13 BEE-4 157
I want to map a combination of batch of degree for a class rooms group of such distance that they make full use of the maximum capacity of the class rooms within a group (ideally), or as close to this as possible. Can it be done with a SQL query?
Any response will be appreciated.
The SQL Scripts to generate the required tables and populate data is less to:
CREATE TABLE classrooms (ClassId NUMBER, ClassName VARCHAR2 (50), capacity NUMBER, group NUMBER);
INSERT INTO the classrooms of the VALUES (1, "Babbage/software Engg Lab', 24, 1");
INSERT INTO the classrooms of the VALUES (2, 'basement - PG block', 63, 1);
INSERT INTO the classrooms of the VALUES (3, '1 class room', 56, 1);
INSERT INTO the classrooms of the VALUES (4, '10 class room', 24, 1);
INSERT INTO the classrooms of the VALUES (5, '11 class room', 24, 1);
INSERT INTO the classrooms of the VALUES (6, 'class room 12', 35, 1);
INSERT INTO the classrooms of the VALUES (7, 'class room 13', 42, 1);
INSERT INTO the classrooms of the VALUES (8, 'class room 14', 42, 1);
INSERT INTO the classrooms of the VALUES (9, '15 'class, 42, 1);
INSERT INTO the classrooms of the VALUES (10, 'class 2', 35, 1);
INSERT INTO the classrooms of the VALUES (11, 'class room 3', 35, 1);
INSERT INTO the classrooms of the VALUES (12, 'class room 4', 35, 1);
INSERT INTO the classrooms of the VALUES (13, 'class room 5', 35, 1);
INSERT INTO the classrooms of the VALUES (14, 'class room 6', 25, 1);
INSERT INTO the classrooms of the VALUES (15, '7 class room', 25, 1);
INSERT INTO the classrooms of the VALUES (16, 'class Room 8', 24, 1);
INSERT INTO the classrooms of the VALUES (17, 'class room 9', 24, 1);
INSERT INTO the classrooms of the VALUES (18, 'Control Sys Lab', 24, 1);
INSERT INTO the classrooms of the VALUES (19, 'Dig & Embd Sys Lab', 20, 1);
INSERT INTO the classrooms of the VALUES (20, 'DSP & Comm Lab', 20, 1);
INSERT INTO the classrooms of the VALUES (21, 'system ELECTROMECHANICAL Lab', 28, 1);
INSERT INTO the classrooms of the VALUES (22, ' Farabi/Web Tech Lab', 36, 1);
INSERT INTO the classrooms of the VALUES (23, 'Gen purpose Lab', 40, 1);
INSERT INTO the classrooms of the VALUES (24, ' Shirazi/DB Tech Lab', 36, 1);
INSERT INTO the classrooms of the VALUES (25, 'Elected Adv Lab', 30, 2);
INSERT INTO the classrooms of the VALUES (26, 'class room 16', 42, 2);
INSERT INTO the classrooms of the VALUES (27, 'class room 17', 49, 2);
INSERT INTO the classrooms of the VALUES (28, '18 'class, 56, 2);
INSERT INTO the classrooms of the VALUES (29, '19 'class, 42, 2);
INSERT INTO the classrooms of the VALUES (30, 'class room 20', 49, 2);
INSERT INTO the classrooms of the VALUES (31, 'class room 21', 35, 3);
INSERT INTO the classrooms of the VALUES (32, 'room 22', 35, 3);
INSERT INTO the classrooms of the VALUES (33, 'MDA Lab', 20, 3);
CREATE TABLE DegreeBatches (BatchId NUMBER, BatchName VARCHAR2 (50), membership NUMBER);
INSERT INTO DegreeBatches VALUES(1,'BIT-11',79);
INSERT INTO DegreeBatches VALUES(2,'BIT-12',28);
INSERT INTO DegreeBatches VALUES (3, 'BS (CS) - 1', 35);
INSERT INTO DegreeBatches VALUES (4, 'BS (CS) - 2', 78);
INSERT INTO DegreeBatches VALUES (5,'BE (SE) - 1', 69);
INSERT INTO DegreeBatches VALUES (6,'BE (SE) - 2', 84);
INSERT INTO DegreeBatches VALUES (7,'BE (SE) - 3', 64);
INSERT INTO DegreeBatches VALUES(8,'BICSE-7',84);
INSERT INTO DegreeBatches VALUES(9,'BICSE-8',43);
INSERT INTO DegreeBatches VALUES(10,'BEE-1',112);
INSERT INTO DegreeBatches VALUES(11,'BEE-2',151);
INSERT INTO DegreeBatches VALUES(12,'BEE-3',157);
INSERT INTO DegreeBatches VALUES(13,'BEE-4',157);
Best regards
Bilal
Published by: Bilal on December 27, 2012 09:52
Published by: Bilal on December 27, 2012 10:07Bilal, thanks for the nice problem! Another possibility to double check is to write a small PL/SQL function that returns 1 if a duplicate id is found, then equate to 0: "NUMBER of RETURN of Duplicate_Token_Found (p_str_main in VARCHAR2, p_str_trial VARCHAR2). It should analyze the second string and could use p_str_main LIKE '%', | l_id | ', %' for each id. In any case, the query complete (without that) is given below:
Solution with names SQL> WITH rsf_itm (con_id, max_weight, nxt_id, lev, tot_weight, tot_profit, path, root_id, lev_1_id) AS ( 2 SELECT c.id, 3 c.max_weight, 4 i.id, 5 0, 6 i.item_weight, 7 i.item_profit, 8 ',' || i.id || ',', 9 i.id, 10 0 11 FROM items i 12 CROSS JOIN containers c 13 UNION ALL 14 SELECT r.con_id, 15 r.max_weight, 16 i.id, 17 r.lev + 1, 18 r.tot_weight + i.item_weight, 19 r.tot_profit + i.item_profit, 20 r.path || i.id || ',', 21 r.root_id, 22 CASE WHEN r.lev = 0 THEN i.id ELSE r.nxt_id END 23 FROM rsf_itm r 24 JOIN items i 25 ON i.id > r.nxt_id 26 AND r.tot_weight + i.item_weight <= r.max_weight 27 ORDER BY 1, 2 28 ) SEARCH DEPTH FIRST BY nxt_id SET line_no 29 , rsf_con (nxt_con_id, nxt_line_no, con_path, itm_path, tot_weight, tot_profit, lev) AS ( 30 SELECT con_id, 31 line_no, 32 To_Char(con_id), 33 ':' || con_id || '-' || (lev + 1) || ':' || path, 34 tot_weight, 35 tot_profit, 36 0 37 FROM rsf_itm 38 UNION ALL 39 SELECT r_i.con_id, 40 r_i.line_no, 41 r_c.con_path || ',' || r_i.con_id, 42 r_c.itm_path || ':' || r_i.con_id || '-' || (r_i.lev + 1) || ':' || r_i.path, 43 r_c.tot_weight + r_i.tot_weight, 44 r_c.tot_profit + r_i.tot_profit, 45 r_c.lev + 1 46 FROM rsf_con r_c 47 JOIN rsf_itm r_i 48 ON r_i.con_id > r_c.nxt_con_id 49 WHERE r_c.itm_path NOT LIKE '%,' || r_i.root_id || ',%' 50 AND r_c.itm_path NOT LIKE '%,' || r_i.lev_1_id || ',%' 51 AND r_c.itm_path NOT LIKE '%,' || r_i.nxt_id || ',%' 52 ) 53 , paths_ranked AS ( 54 SELECT itm_path || ':' itm_path, tot_weight, tot_profit, lev + 1 n_cons, 55 Rank () OVER (ORDER BY tot_profit DESC) rnk, 56 Row_Number () OVER (ORDER BY tot_profit DESC) sol_id 57 FROM rsf_con 58 ), best_paths AS ( 59 SELECT itm_path, tot_weight, tot_profit, n_cons, sol_id 60 FROM paths_ranked 61 WHERE rnk = 1 62 ), row_gen AS ( 63 SELECT LEVEL lev 64 FROM DUAL 65 CONNECT BY LEVEL <= (SELECT Count(*) FROM items) 66 ), con_v AS ( 67 SELECT b.itm_path, r.lev con_ind, b.sol_id, b.tot_weight, b.tot_profit, 68 Substr (b.itm_path, Instr (b.itm_path, ':', 1, 2*r.lev - 1) + 1, 69 Instr (b.itm_path, ':', 1, 2*r.lev) - Instr (b.itm_path, ':', 1, 2*r.lev - 1) - 1) 70 con_nit_id, 71 Substr (b.itm_path, Instr (b.itm_path, ':', 1, 2*r.lev) + 1, 72 Instr (b.itm_path, ':', 1, 2*r.lev + 1) - Instr (b.itm_path, ':', 1, 2*r.lev) - 1) 73 itm_str 74 FROM best_paths b 75 JOIN row_gen r 76 ON r.lev <= b.n_cons 77 ), con_split AS ( 78 SELECT itm_path, con_ind, sol_id, tot_weight, tot_profit, 79 Substr (con_nit_id, 1, Instr (con_nit_id, '-', 1) - 1) con_id, 80 Substr (con_nit_id, Instr (con_nit_id, '-', 1) + 1) n_items, 81 itm_str 82 FROM con_v 83 ), itm_v AS ( 84 SELECT c.itm_path, c.con_ind, c.sol_id, c.con_id, c.tot_weight, c.tot_profit, 85 Substr (c.itm_str, Instr (c.itm_str, ',', 1, r.lev) + 1, 86 Instr (c.itm_str, ',', 1, r.lev + 1) - Instr (c.itm_str, ',', 1, r.lev) - 1) 87 itm_id 88 FROM con_split c 89 JOIN row_gen r 90 ON r.lev <= c.n_items 91 ) 92 SELECT v.sol_id, 93 v.tot_weight s_wt, v.tot_profit s_pr, c.id c_id, c.name c_name, c.max_weight m_wt, 94 Sum (i.item_weight) OVER (PARTITION BY v.sol_id, c.id) c_wt, 95 i.id i_id, i.name i_name, i.item_weight i_wt, i.item_profit i_pr 96 FROM itm_v v 97 JOIN containers c 98 ON c.id = To_Number (v.con_id) 99 JOIN items i 100 ON i.id = To_Number (v.itm_id) 101 ORDER BY sol_id, con_id, itm_id 102 / SOL_ID S_WT S_PR C_ID C_NAME M_WT C_WT I_ID I_NAME I_WT I_PR ---------- ---- ---- ----- --------------- ---- ---- ----- ---------- ---- ---- 1 255 255 1 SEECS UG Block 100 100 1 BIT-10 35 35 2 BIT-11 40 40 6 BICSE-7 25 25 2 IAEC Building 70 70 4 BSCS-3 40 40 7 BESE-3 30 30 3 RIMMS Building 90 85 3 BSCS-2 35 35 5 BEE-4 50 50 2 255 255 1 SEECS UG Block 100 95 4 BSCS-3 40 40 6 BICSE-7 25 25 7 BESE-3 30 30 2 IAEC Building 70 70 1 BIT-10 35 35 3 BSCS-2 35 35 3 RIMMS Building 90 90 2 BIT-11 40 40 5 BEE-4 50 50 3 255 255 1 SEECS UG Block 100 100 3 BSCS-2 35 35 4 BSCS-3 40 40 6 BICSE-7 25 25 2 IAEC Building 70 65 1 BIT-10 35 35 7 BESE-3 30 30 3 RIMMS Building 90 90 2 BIT-11 40 40 5 BEE-4 50 50 4 255 255 1 SEECS UG Block 100 100 3 BSCS-2 35 35 4 BSCS-3 40 40 6 BICSE-7 25 25 2 IAEC Building 70 70 2 BIT-11 40 40 7 BESE-3 30 30 3 RIMMS Building 90 85 1 BIT-10 35 35 5 BEE-4 50 50 5 255 255 1 SEECS UG Block 100 95 2 BIT-11 40 40 6 BICSE-7 25 25 7 BESE-3 30 30 2 IAEC Building 70 70 1 BIT-10 35 35 3 BSCS-2 35 35 3 RIMMS Building 90 90 4 BSCS-3 40 40 5 BEE-4 50 50 6 255 255 1 SEECS UG Block 100 100 2 BIT-11 40 40 3 BSCS-2 35 35 6 BICSE-7 25 25 2 IAEC Building 70 65 1 BIT-10 35 35 7 BESE-3 30 30 3 RIMMS Building 90 90 4 BSCS-3 40 40 5 BEE-4 50 50 7 255 255 1 SEECS UG Block 100 100 2 BIT-11 40 40 3 BSCS-2 35 35 6 BICSE-7 25 25 2 IAEC Building 70 70 4 BSCS-3 40 40 7 BESE-3 30 30 3 RIMMS Building 90 85 1 BIT-10 35 35 5 BEE-4 50 50 8 255 255 1 SEECS UG Block 100 100 1 BIT-10 35 35 4 BSCS-3 40 40 6 BICSE-7 25 25 2 IAEC Building 70 70 2 BIT-11 40 40 7 BESE-3 30 30 3 RIMMS Building 90 85 3 BSCS-2 35 35 5 BEE-4 50 50 9 255 255 1 SEECS UG Block 100 100 1 BIT-10 35 35 4 BSCS-3 40 40 6 BICSE-7 25 25 2 IAEC Building 70 65 3 BSCS-2 35 35 7 BESE-3 30 30 3 RIMMS Building 90 90 2 BIT-11 40 40 5 BEE-4 50 50 10 255 255 1 SEECS UG Block 100 100 1 BIT-10 35 35 3 BSCS-2 35 35 7 BESE-3 30 30 2 IAEC Building 70 65 2 BIT-11 40 40 6 BICSE-7 25 25 3 RIMMS Building 90 90 4 BSCS-3 40 40 5 BEE-4 50 50 11 255 255 1 SEECS UG Block 100 100 1 BIT-10 35 35 3 BSCS-2 35 35 7 BESE-3 30 30 2 IAEC Building 70 65 4 BSCS-3 40 40 6 BICSE-7 25 25 3 RIMMS Building 90 90 2 BIT-11 40 40 5 BEE-4 50 50 12 255 255 1 SEECS UG Block 100 95 1 BIT-10 35 35 3 BSCS-2 35 35 6 BICSE-7 25 25 2 IAEC Building 70 70 2 BIT-11 40 40 7 BESE-3 30 30 3 RIMMS Building 90 90 4 BSCS-3 40 40 5 BEE-4 50 50 13 255 255 1 SEECS UG Block 100 95 1 BIT-10 35 35 3 BSCS-2 35 35 6 BICSE-7 25 25 2 IAEC Building 70 70 4 BSCS-3 40 40 7 BESE-3 30 30 3 RIMMS Building 90 90 2 BIT-11 40 40 5 BEE-4 50 50 14 255 255 1 SEECS UG Block 100 100 1 BIT-10 35 35 2 BIT-11 40 40 6 BICSE-7 25 25 2 IAEC Building 70 65 3 BSCS-2 35 35 7 BESE-3 30 30 3 RIMMS Building 90 90 4 BSCS-3 40 40 5 BEE-4 50 50 98 rows selected. Elapsed: 00:00:01.42
Published by: BrendanP on January 20, 2013 11:25
I found the need to deduplicate regular expression:AND RegExp_Instr (r_c.itm_path | r_i.path, ',(\d+),.*?,\1,') = 0)
-
Single SQL query for the analysis of the date of customs declaration under the table of Stock codes
Dear all,
Please tell us a single SQL query for the below,
We have a Table of Stock as shown below,
STOCK_TABLE
ITEM_CODE
(item code)
BAT_NO
(lot no.)
TXN_CODE
(transaction code)
DOC_NO
(number)
BOE_DT
(date of the customs declaration)
I1
B1
I1
I2
I3
B70
I4
B80
I5
B90
T102
1234
JULY 2, 2015
I6
B100
We have to find the date of customs declaration (i.e. the date when the items have come under this particular table) for items that are not attached to any document (that is, who have TXN_CODE, DOC_NO and BOE_DT fields with a NULL value).
For each item in the table of actions, which is not attached to any document, the customs declaration date is calculated as follows.
- If (code section, lot number) combination is present under HISTORY_TABLE, the date of customs declaration will receive the UPDT_DT, the transaction code (TXN_CODE) is an IN or transactions (which can be analyzed from the TRANSACTIONS table).
- If (code section, lot number) combination is NOT currently at the HISTORY_TABLE (or) the transaction code respective to item - batch number combination code is an operation then customs declaration date will be the date of the document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD that contains the element of that particular lot.
- If the case 1 and case 2 fails, our customs declaration date will be the last date of document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD containing that particular item and the BAT_NO in expected results will be that corresponding to this document, as appropriate, to another NULL.
- If the case 1 or case 2 is successful, the value of the last field (in the output expected, shown further below) BATCH_YN will be 'Y', because it fits the lot. Otherwise it will be 'n'.
-
Pool pane there problem with long sql query?
Hello
I use Jdeveloper 11.1.2.2.0
In the application I'm developing, there is a long sql query to call (it's a function from a package, which may take a few minutes to run) and I want to display a progress bar for the user.
The progress bar component is a "progress indicator" and the percentage of achivement is refreshed by a component 'pool' with 1-second interval.
The two components are connected in a javabean.
The function with the sql query is the javabean too.
To run the sql query that is long on background I am calling from a thread, and the pool component get the advancement of the percentage of a pipe filled with the sql function.
If the function to run is just a long loop of java operations the progress bar works fine, but if I put my long sql query instead, stop listener pool should be performed to stop long, s sql queryo progress are updated only at the end of the long sql query.
You have any ideas?
Thank you
Thanks for your replies. Unfortunately, it was not the solution to my case, sql procedures to block the entire application while ADF awaits them at the end...
To solve my problem, I finally used a PL SQL Job to call my sql procedure (dbms_job.submit).
The application is released right after the call and the component of the pool is not more secure!
Kind regards
Yann
-
Vs. runtime vs. ViewObject ViewObject SQL query in the xml file.
Hello
I wonder what is the difference between query SQL in the long term, creating a view object in the duration and the creation of a display with an XML object.
I'm not trying to have the result set cached just to pick once.
My code for a creation of a view in a run-time object:
HashSet<Integer> allPersonIdThatUserHasAccessTo = new HashSet<Integer>(); AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl"); String sqlStr = "SELECT up.person_id FROM user_person up where up.user_id = " + userId; ViewObjectImpl vo = (ViewObjectImpl)am.createViewObjectFromQueryStmt("AllPeopleUserHasAccessToVo", sqlStr); vo.executeQuery(); RowSetIterator rsi = vo.createRowSetIterator(null); while (rsi.hasNext()) { Row personRow = rsi.next(); Integer personId = ((BigDecimal)personRow.getAttribute(0)).intValue(); allPersonIdThatUserHasAccessTo.add(personId); } rsi.closeRowSetIterator(); vo.remove();
When should I use SQL query, when the view object use at time of execution and time to create the view object to an xml file?
In general you should not write this code in a managed bean. Access code or in your case creating a VO belongs behind the façade in the module of the application.
You can create the original Version, but the main difference is that it takes more time. Code everything that the definition of VO created in the data model of the application module would make too and it clears directly after the query only to create the same code again the next time you call the method.
If the goal is not to keep the data, you can create the hashset class and call executeEmptyRowSet() on the VO (https://blogs.oracle.com/smuenchadf/entry/what_does_executeemptyrowset_d for details). This way you only need a VO that takes a parameter and gets you the same result in less time.
Timo
-
Dynamic SQL query in the DB adapter
Hello
I want to use the following custom SQL query in the DB adapter:
SELECT EMP_ID, EMP_NAME, EMP_LOCATION FROM EMP WHERE EMP_ID IN (#iNPUT_PARAMETER)
the problem I'm facing is that I don't know at the time of the development that EMP_ID how much will be passed to the process so that I can not use the input parameter specific number. I cannot use it IN the query within which statement I concatenate all the EMP_ID separated by comma and passed under INPUT_PARAMETER, but when running, he read the full concatenated string as a single string rather than identify them as a list of different: with comma separation. could someone help me in this case
Thank you
SunilUse the following query with two parameters. Build the string with delimiter when running and pass this string and delimiter to query... (in this example, the input value would be the same for both Delimiter1 and Delimiter2.)
Select * from EMP WHERE deptno IN (SELECT SUBSTR (STRING_TO_TOKENIZE, DECODE (LEVEL, 1, 1, INSTR (STRING_TO_TOKENIZE, SEPARATOR, 1, LEVEL-1) + 1), INSTR (STRING_TO_TOKENIZE, SEPARATOR, 1, LEVEL)-DECODE (LEVEL, 1, 1, INSTR (STRING_TO_TOKENIZE, SEPARATOR, 1, LEVEL-1) + 1)) FROM (SELECT #StringToTokenizer | #Delimiter1 AS STRING_TO_TOKENIZE, #Delimiter2 AS DELIMITER FROM DUAL) CONNECT BY INSTR (STRING_TO_TOKENIZE SEPARATOR) ((, 1, LEVEL) > 0)
Thank you
-Sreeny -
Hello
Kindly let me know how to print the query, and the parameters passed to it? I tried with the params parameter in super.executeQueryForCollection (qc, params, noUserParams); but could not succeed.
I need save the query and the parameters passed to it. Kindly help.
Thanks in advance,
Kalpana.
Here you go
Coding with Passion: Oracle ADF - Debug Mode object query with parameters
-
HP 15-f305ddx: I haveva hp 15-f305dx with an error code and the password of the bios 58495227
I have a haveva hp 15-f305dx with an error code and the password of the bios 58495227
Thank you so much, you're the best
-
Unplugged network cable?
Recently I get this message then on the line. You are not connected to the internet! You want to work offline or try again? There is also a box with a red x and the message reads unplugged network cable. It is very aggravating. Can someone tell me how to solve this problem? It might have something to do with my firewall? I recently downloaded mozzilla firefox if I could play words with friends, because IE would not work on the game.Hi LouisteanGriffin,
· Did you do changes on the computer before the show?
Follow these methods.
Method 1: Follow these steps:
Step 1: Start the computer in safe mode with network and check if the problem persists.
A description of the options to start in Windows XP Mode
http://support.Microsoft.com/kb/315222
Step 2: If the problem does not persist in SafeMode with network, perform a clean boot to see if there is no conflict of software like clean boot helps you eliminate software conflicts.
How to configure Windows XP to start in a "clean boot" State
http://support.Microsoft.com/kb/310353
Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state of the link to return the computer to a Normal startupmode.
After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.
(a) click Start, run.
(b) type msconfigand click OK.
(c) the System Configuration Utility dialog box appears.
(d) click the general tab, click Normal startup - load all services and device drivers and then click OK.
(e) when you are prompted, click on restart to restart the computer.
Method 2: Temporarily disable the security software.
Note: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you do not disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network during the time that your antivirus software is disabled, your computer is vulnerable to attacks.
Method 3: Follow the steps in the article.
How to troubleshoot a network home in Windows XP
Windows wireless and wired network connection problems
For reference:
-
I recently tried to remove malware on my Vista based laptop Toshiba.
I recently tried to remove malware on my Vista based laptop Toshiba. Malwarebytes helped, but I still have problems with a redirect virus and the refusal by the system to allow me to download various things, Windows Live Mail in particular. I tried to download from a copy of the USB stick to a clean computer, but he still refuses to load telling me to check my internet connection, which is fine for general use. Please help I get crazy and do not forget that I am a pure layman - thank you if you can help - Kidso
I found that the best place to ask this type of question is here: -.
http://forums.ComputerActive.co.UK/forumdisplay.php?f=20
There are some very good people out there who helped me (successfully) on 2 occasions.
Good luck.
I'll be interested to know how you go.
-
- I am trying to burn a DVD with Windows DVD maker and the tiles are about 3 hours or so in total and I thought it's too big – is it possible to use SP, SLP or ED when burning to a DVD problem
- I am trying to burn a DVD with Windows DVD maker and the tiles are about 3 hours or so in total and I thought it's too big – is it possible to use SP, SLP or ED when burning to a DVD problem
==========================================
The following article shows 150 minutes on a single DVD layer, but
I'd be surprised if it always worked this way. In any case...
Perhaps you could use a DVD double layer if your burner will handle it.Windows Vista - DVD - video burning - frequently asked questions
http://Windows.Microsoft.com/en-us/Windows-Vista/DVD-Video-burning-frequently-asked-questionsSplitting the project between 2 or 3 DVD might be the best option.
Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.
-
I wipe my laptop and keyboard mouse with a paper towel and the screen turned sideways, how I recover the right way?
Hi ken1957,
Try pressing Ctrl +
or to rotate the screen.
HISTORY_TABLE
ITEM_CODE | BAT_NO |
TXN_CODE
DOC_NO
UPDT_DT
I1
B1
T1
1234
JANUARY 3, 2015
I1
B20
T20
4567
MARCH 3, 2015
I1
B30
T30
7890
FEBRUARY 5, 2015
I2
B40
T20
1234
JANUARY 1, 2015
TRANSACTION
TXN_CODE | TXN_TYPE |
T1 | IN |
T20 |
OFF
T30
ALL THE
T50
IN
T80
IN
T90
IN
T60
ALL THE
T70
ALL THE
T40
ALL THE
IN_TABLE_HEAD_1
H1_SYS_ID (primary key) | TXN_CODE | DOC_NO |
DOC_DATE
H1ID1
T1
1234
JANUARY 1, 2015
H1ID2
T70
1234
FEBRUARY 1, 2015
IN_TABLE_ITEM_1
I1_SYS_ID |
H1_SYS_ID
(foreign key referencing H1_SYS_ID in IN_TABLE_HEAD_1)
ITEM_CODE
I1ID1
H1ID1
I1
I1ID2
H1ID1
I100
I1ID3
H1ID2
I3
IN_TABLE_BATCH_1
B1_SYS_ID | TXN_CODE DOC_NO (now in IN_TABLE_HEAD_1) | BAT_NO |
B1ID1
T1
1234
B1 / can be empty
B1ID2
T70
1234
B70
IN_TABLE_HEAD_2
H2_SYS_ID (primary key) | TXN_CODE |
DOC_NO
DOC_DATE
H2ID1
T30
4567
FEBRUARY 3, 2015
H2ID2
T60
1234
JANUARY 3, 2015
IN_TABLE_ITEM_2
I2_SYS_ID | H2_SYS_ID (foreign key referencing H2_SYS_ID in IN_TABLE_HEAD_2) | ITEM_CODE |
I2ID1 | H2ID1 |
I1
I2ID2
H2ID1
I200
I2ID3
H2ID2
I2
IN_TABLE_BATCH_2
B2_SYS_ID |
I2_SYS_ID
(foreign key referencing I2_SYS_ID in IN_TABLE_ITEM_2)
BAT_NO
B2ID1
I2ID1
B30 / null
B2ID2
I2ID2
B90
B2ID2
I2ID3
B60
IN_TABLE_HEAD_3
H3_SYS_ID (primary key) | TXN_CODE | DOC_NO | DOC_DATE |
H3ID1 |
T50
1234
JANUARY 2, 2015
H3ID2
T80
1234
JANUARY 3, 2015
H3ID3
T90
1234
JANUARY 4, 2015
H3ID4
T40
1234
AUGUST 5, 2015
IN_TABLE_ITEM_3
I3_SYS_ID |
H3_SYS_ID
(foreign key referencing H3_SYS_ID in IN_TABLE_HEAD_3)
ITEM_CODE
BAT_NO
I3ID1
H31D1
I2
B50
I3ID2
H3ID2
I4
B40
I3ID3
H3ID3
I4
I3ID4
H3ID4
I6
There is no IN_TABLE_BATCH_3
Please find below the expected results.
OUTPUT
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO |
BOE_DT
BATCH_YN
I1
B1
T1
1234
JANUARY 3, 2015
THERE
I1
B30
T30
7890
FEBRUARY 5, 2015
N
I2
B60
T60
1234
JANUARY 3, 2015
N
I3
B70
T70
1234
FEBRUARY 1, 2015
THERE
I4
T90
1234
JANUARY 4, 2015
N
I6
T40
1234
AUGUST 5, 2015
N
Controls database to create the tables above and insert the records.
CREATE TABLE stock_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), boe_dt DATE );
INSERT EN stock_table
VALUES ('I1', 'B1', '', '', '');
INSERT EN stock_table
VALUES ('I1', '', '', '', '');
INSERT IN stock_table
VALUES ('I2', '', '', '', '');
INSERT EN stock_table
VALUES ('I3', 'B70', '', '', '');
INSERT EN stock_table
VALUES ('I4', 'B80', '', '', '');
INSERT EN stock_table
VALUES ('I5', 'B90', 'T102', '1234', '02-JUL-2015');
INSERT EN stock_table
VALUES ('I6', 'B100', '', '', '');
SELECT *
FROM stock_table
CREATE TABLE history_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), updt_dt DATE );
INSERT IN history_table
VALUES ('I1', 'B1', 'T1', '1234', '03-JAN-2015');
INSERT IN history_table
VALUES ('I1', 'B20', 'T20', '4567', '03-MAR-2015');
INSERT IN history_table
VALUES ('I1', 'B30', 'T30', '7890', '05-FEB-2015');
INSERT IN history_table
VALUES ('I2', 'B40', 'T20', '1234', '01-JAN-2015');
SELECT *
FROM history_table
CREATE TABLE transaction1()txn_code VARCHAR()80),txn_type VARCHAR()80));
INSERT INTO transaction1
VALUES ('T1', 'IN');
INSERT INTO transaction1
VALUES ('T20', 'OUT');
INSERT INTO transaction1
VALUES ('T30', 'ALL');
INSERT INTO transaction1
VALUES ('T40', 'ALL');
INSERT INTO transaction1
VALUES ('T50', 'IN');
INSERT INTO transaction1
VALUES ('T60', 'ALL');
INSERT INTO transaction1
VALUES ('T70', 'ALL');
INSERT INTO transaction1
VALUES ('T80', 'IN');
INSERT INTO transaction1
VALUES ('T90', 'IN');
SELECT *
FROM transaction1
CREATE TABLE in_table_head_1()h1_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_2()h2_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_3()h3_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
INSERT IN in_table_head_1
VALUES ('H1ID1', 'T1', '1234', '01-JAN-2015');
INSERT IN in_table_head_1
VALUES ('H1ID2', 'T70', '1234', '01-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID1', 'T30', '4567', '03-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID2', 'T60', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID1', 'T50', '1234', '02-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID2', 'T80', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID3', 'T90', '1234', '05-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID4', 'T40', '1234', '05-AUG-2015');
CREATE TABLE in_table_item_1()i1_sys_id VARCHAR2()80) PRIMARY KEY,
h1_sys_id VARCHAR2 (80) REFERENCES in_table_head_1()h1_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_2()i2_sys_id VARCHAR2()80) PRIMARY KEY,
h2_sys_id VARCHAR2 (80) REFERENCES in_table_head_2()h2_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_3(i3_sys_id VARCHAR2(80) PRIMARY KEY,
h3_sys_id VARCHAR2 (80) REFERENCES in_table_head_3()h3_sys_id),item_code VARCHAR2()80),
bat_no VARCHAR2 (80));
INSERT IN in_table_item_1
VALUES ('I1ID1', 'H1ID1', 'I1');
INSERT IN in_table_item_1
VALUES ('I1ID2', 'H1ID1', 'I100');
INSERT IN in_table_item_1
VALUES ('I1ID3', 'H1ID2', 'I3');
INSERT IN in_table_item_2
VALUES ('I2ID1', 'H2ID1', 'I1');
INSERT IN in_table_item_2
VALUES ('I2ID2', 'H2ID1', 'I200');
INSERT IN in_table_item_2
VALUES ('I2ID3', 'H2ID2', 'I2');
INSERT IN in_table_item_3
VALUES ('I3ID1', 'H3ID1', 'I2','B50');
INSERT IN in_table_item_3
VALUES ('I3ID2', 'H3ID2', 'I4','B40');
INSERT IN in_table_item_3
VALUES ('I3ID3', 'H3ID3', 'I4','');
INSERT IN in_table_item_3
VALUES ('I3ID4', 'H3ID4', 'I6','');
SELECT *
FROM in_table_item_1
SELECT *
FROM in_table_item_2
SELECT *
FROM in_table_item_3
CREATE TABLE in_table_batch_1()b1_sys_id VARCHAR2()80) PRIMARY KEY,
txn_code VARCHAR2 (80), doc_no VARCHAR2 (80), bat_no VARCHAR2 (80));
CREATE TABLE in_table_batch_2()b2_sys_id VARCHAR2()80) PRIMARY KEY,
i2_sys_id VARCHAR2 (80) REFERENCES in_table_item_2()i2_sys_id),bat_no VARCHAR2()80));
INSERT IN in_table_batch_1
VALUES ('B1ID1', 'T1', '1234', 'B1');
INSERT IN in_table_batch_1
VALUES ('B1ID2', 'T70', '1234', 'B70');
INSERT IN in_table_batch_2
VALUES ('B2ID1', 'I2ID1', 'B30');
INSERT IN in_table_batch_2
VALUES ('B2ID2', 'I2ID2', 'B90');
INSERT IN in_table_batch_2
VALUES ('B2ID3', 'I2ID3', 'B60');
Please advise a solution for the same.
Thank you and best regards,
Séverine Suresh
very forced (question subfactoring used to allow easy testing/verification - could work with these test data only)
with
case_1 as
(select s.item_code,
s.bat_no,
h.txn_code,
h.doc_no,
h.updt_dt boe_dt,
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 1' '.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of w_stock_table
where bat_no is null
or txn_code is null
or doc_no is null
or boe_dt is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and s.bat_no = h.bat_no
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
),
case_2 as
(select s.item_code,
NVL (s.bat_no, h.bat_no) bat_no.
NVL (s.txn_code, h.txn_code) txn_code.
NVL (s.doc_no, h.doc_no) doc_no.
NVL (s.boe_dt, h.updt_dt) updt_dt.
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 2'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of case_1
where refers_to is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
and not exists (select null
of case_1
where item_code = h.item_code
and bat_no = h.bat_no
and txn_code = h.txn_code
and doc_no = h.doc_no
and updt_dt = h.updt_dt
)
),
case_31 as
(select s1.item_code,
NVL (S1.bat_no, W1.bat_no) bat_no.
NVL (S1.txn_code, W1.txn_code) txn_code.
NVL (S1.doc_no, W1.doc_no) doc_no.
NVL (S1.updt_dt, W1.doc_dt) updt_dt.
cases where s1.bat_no = w1.bat_no then 'Y' else ' n end batch_yn.
cases where w1.txn_code is not null
and w1.doc_no is not null
and w1.doc_dt is not null
then "case 31'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s1
left outer join
(select i1.item_code, h1.txn_code, h1.doc_no, h1.doc_dt, b1.bat_no
of w_in_table_item_1 i1
inner join
w_in_table_head_1 h1
On i1.h1_sys_id = h1.h1_sys_id
inner join
w_in_table_batch_1 b1
On h1.txn_code = b1.txn_code
and h1.doc_no = b1.doc_no
) w1
On s1.item_code = w1.item_code
),
case_32 as
(select s2.item_code,
NVL (S2.bat_no, W2.bat_no) bat_no.
NVL (S2.txn_code, W2.txn_code) txn_code.
NVL (S2.doc_no, W2.doc_no) doc_no.
NVL (S2.updt_dt, W2.doc_dt) updt_dt.
cases where s2.bat_no = w2.bat_no then 'Y' else ' n end batch_yn.
cases where w2.txn_code is not null
and w2.doc_no is not null
and w2.doc_dt is not null
then "case 32'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s2
left outer join
(select i2.item_code, h2.txn_code, h2.doc_no, h2.doc_dt, b2.bat_no
of w_in_table_item_2 i2
inner join
w_in_table_head_2 h2
On i2.h2_sys_id = h2.h2_sys_id
inner join
w_in_table_batch_2 b2
On i2.i2_sys_id = b2.i2_sys_id
) w2
On s2.item_code = w2.item_code
),
case_33 as
(select s3.item_code,
w3.bat_no,
NVL (S3.txn_code, w3.txn_code) txn_code.
NVL (S3.doc_no, w3.doc_no) doc_no.
NVL (S3.updt_dt, w3.doc_dt) updt_dt.
cases where s3.bat_no = w3.bat_no then 'Y' else ' n end batch_yn.
cases where w3.txn_code is not null
and w3.doc_no is not null
and w3.doc_dt is not null
then "case 33'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s3
left outer join
(select i3.item_code, h3.txn_code, h3.doc_no, h3.doc_dt, i3.bat_no
of w_in_table_item_3 i3
inner join
w_in_table_head_3 h3
On i3.h3_sys_id = h3.h3_sys_id
) w3
On s3.item_code = w3.item_code
)
Select item_code, bat_no, txn_code, doc_no, boe_dt, batch_yn
of case_1
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_2
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn,
ROW_NUMBER() over (partition by item_code of updt_dt desc order) rn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_31
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_32
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_33
where refers_to is not null
)
)
where rn = 1
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO | BOE_DT | BATCH_YN |
---|---|---|---|---|---|
I1 | B1 | T1 | 1234 | JANUARY 3, 2015 | THERE |
I1 | B30 | T30 | 7890 | FEBRUARY 5, 2015 | N |
I2 | B60 | T60 | 1234 | JANUARY 3, 2015 | N |
I3 | B70 | T70 | 1234 | FEBRUARY 1, 2015 | THERE |
I4 | - | T90 | 1234 | JANUARY 5, 2015 | N |
I6 | - | T40 | 1234 | AUGUST 5, 2015 | N |
Concerning
Etbin
Maybe you are looking for
-
Recording on a problem with Vista profile
I have a laptop model Satellite L300-1 has 3 less than 1 year for home use that is running Windows Vista. I have problems to connect. Usually, when I connect I just enter my password (i.e. no required user id) and it then takes me to the main area wh
-
How to transfer my files from C: to D:? I've heard people tat right click. After a right-click what should I do? Please explain to mi in a long-running method. Thank you
-
I just want to be able to add my new printer, but I am at least the third person to use this computer. Any ideas on how to change the Administrator information or in order to bypass the message would be appreciated :)
-
(0 x 40000015) at the location 0x002cf9bd
Original title: (0 x 40000015) at location 0x002cf9bd,. This error came a couple of days, please help, I have a hp touchsmart 320, every start he says code error (0 x 40000015) at the location 0x002cf9bd,.
-
Replaced the Cert has expired on GBA
Hello I replaced an ACS certificate that had been installed then I did the following: 1 has created a certificate request. 2A issued the request to the certification of company. 3. copy the certificate to an ftp server. 4 install the certificate on G