Left join between two tables using two different conditions
I have following three tables with their data, as shown below.CREATE TABLE TIREMASTERPROCESS_TEMP
(
PRODUCTIONCODE TANK (12 BYTES),
FIELDNAME CHAR (12 BYTES),
DATACHR VARCHAR2 (60 BYTE),
REVISIONNO TANK (3 BYTES),
DATANUM NUMBER (9.4)
)
Whether the table c. and its sample data are like
FIELDNAME DATACHR REVISIONNO DATANUM PRODUCTIONCODE
AB No. Nch 1 100 0
AB No. Nch 1 108 0
AB No.-of-Nch 1 1 0
Ass42 teased dishes 1 0
Ass42 BTDrumNo1 BTD-051 1 0
AB53 BTDrumNo1 BTD-051 104 0
CREATE TABLE materialcode
(
UPPERMATERIALCODE CHAR (20),
PROCESSNO TANK (3),
PROCESSADOPTDATE TANK (9)
)
Whether the table b. and its sample data are like
UPPERMATERIALCODE PROCESSNO PROCESSADOPTDATE
Ass42 1 20120717
AB53 108 20121121
111 20111104 AS05
104 20120928 AS30
CREATE TABLE BUILDINGSCHEDULEMASTER
(
BUILDINGSIZE TANK (5 BYTES),
GTCODE FLOAT (4 BYTES),
TIREPERCART NUMBER (3.0).
BUILDINGLOT NUMBER (3.0)
)
Whether table and its sample data are like
BUILDINGSIZE GTCODE TIREPERCART BUILDINGLOT
AB42A 4 12 ass42
AB53A 4 88 AB53
AS30A AS30 4 80
BF03A 1 90 BF03
Now, I need to get some data in these fields by using the suite of mappings.
« PR_ » || Trim (a.BUILDINGSIZE) | ' / MPL2' Processid,--PRIMARY KEY
TO_DATE (substr (NVL(b.PROCESSADOPTDATE,'19800101'), 7, 2) |) » /'|| SUBSTR (NVL(b.PROCESSADOPTDATE,'19800101'), 5, 2) | » /'|| SUBSTR (NVL(b.PROCESSADOPTDATE,'19800101'), 1, 4). (' 01:00:00 ',' dd-mm-yyyy hh24:mi:ss') starteff, to_date (SUBSTR (NVL(b.PROCESSADOPTDATE,'19800101'), 7, 2) |) » /'|| SUBSTR (NVL(b.PROCESSADOPTDATE,'19800101'), 5, 2) | » /'|| SUBSTR (NVL(b.PROCESSADOPTDATE,'19800101'), 1, 4). (' 01:00:00 ',' dd-mm-yyyy hh24:mi:ss') startDate.
b.PROCESSNO revisioncodeid,
a.BUILDINGLOT tirepercart ,
CASE WHEN c.FIELDNAME = 'BTDrumNo1' then c.DATACHR end drumtype1.
BOX WHEN (trim (C.DATACHR) = '1' and trim (C.FIELDNAME) = "No. Nch") and THEN click 'YES '.
ANOTHER 'NO '.
END may-BUG,
case
When c.FIELDNAME = 'Wavy'
AND c.DATACHR = 'Use' THEN on 'YES '.
When c.FIELDNAME = 'Wavy'
AND c.DATACHR <>'Use' THEN 'NO '.
fine wavy
Now for the tables A and B I have the simple join as condition
a.GTCODE = b.UPPERMATERIALCODE
But I have to use two different left join conditions to join the table B and C to calculate the RESP fields according to the condition.
Now, I have to use
(trim (b.UPPERMATERIALCODE)). » -'|| Trim (b.PROCESSNO) = Trim (c.PRODUCTIONCODE) | » -'|| Trim (c.REVISIONNO)
condition to get the data for the WAVY and DRUMTYPE1 fields.
But at the same time, I have to use
substr (Trim (b.UPPERMATERIALCODE), 1, 2). » -'|| Trim (b.PROCESSNO) = Trim (c.PRODUCTIONCODE) | » -'|| Trim (c.REVISIONNO)
conition to derive the CHAFER field.
And for this reason I am come so many duplicates and do not correct results for JUNEBUG, WAVY, DRUMTYPE1, and STARTDATE field.
I need some advice as how can I do so that I get the correct results without duplicates for the PRIMARY KEY.
Thank you
Mahesh
It would have been easier to answer if you gave us your example query that gives incorrect results - which both show us what you are doing and give us a starting point.
Insert instructions for data, rather than only the data would have helped too, making it more quick to test this point.
You do not show what you have done with your two outer join criteria, but I think you need to list TIREMASTERPROCESS_TEMP in your query twice, with alias names. Here's what I did:
select a.BUILDINGSIZE, a.GTCODE, b.PROCESSNO , c1.FIELDNAME, c1.DATACHR, C2.FIELDNAME, C2.DATACHR
, CASE WHEN c1.FIELDNAME='BTDrumNo1' then c1.DATACHR end drumtype1
, CASE WHEN (trim(c2.DATACHR) = '1' and trim(c2.FIELDNAME) = 'No-of-Nch') THEN 'YES' ELSE 'NO' END CHAFER
, case when c1.FIELDNAME='Wavy' AND c1.DATACHR='Use' THEN 'YES'
when c1.FIELDNAME='Wavy' then 'NO' else null end wavy
from BUILDINGSCHEDULEMASTER A
join materialcode b on a.GTCODE=b.UPPERMATERIALCODE
left outer join TIREMASTERPROCESS_TEMP c1
ON trim(b.UPPERMATERIALCODE)||'-'||trim(b.PROCESSNO) = trim(c1.PRODUCTIONCODE)||'-'||trim(c1.REVISIONNO)
left outer join TIREMASTERPROCESS_TEMP c2
ON substr(trim(b.UPPERMATERIALCODE),1,2)||'-'||trim(b.PROCESSNO) = trim(c2.PRODUCTIONCODE)||'-'||trim(c2.REVISIONNO)
C1 is an alias for the TIREMASTERPROCESS_TEMP line which is necessary for drumtype1 and wavy, c2 is an alias for the TIREMASTERPROCESS_TEMP line required for JuneBug. There was some minor errors in your calculations of field I tried to correct.
The results are:
BUILD GTCO PRO FIELDNAME DATACHR FIELDNAME DATACHR DRUMTYPE1 CHA WAV
----- ---- --- ------------ ---------- ------------ ---------- ---------- --- ---
AB53A AB53 108 No-of-Nch 1 YES
AB42A AB42 1 BTDrumNo1 BTD-051 No-of-Nch 1 BTD-051 YES
AB42A AB42 1 Wavy NotUse No-of-Nch 1 YES NO
AS30A AS30 104 NO
Hope this helps,
David
Tags: Database
Similar Questions
-
I want to bridge.and wireless I can't do that... Please send me how to write to a wireless bridge between two different routers.
1:broadbandand2:Dlink dir 605 l,Hi Mohammed Ehsan Jourah,.
Thanks for posting the request in the Microsoft community forums.
I understand that you need to know how to make a wireless bridge between two different routersWhat version of the operating system is installed on the computer?
To connect multiple computers, install a network adapter in each and run a network CAT5 cabling to connect each one to a hub (and thus the other.) The computer that will serve as a transition will have a standard network card for wired and a wireless network adapter that will connect to the wireless (WAP) access point or gateway on the second network.
A network bridge is software or hardware that connects two networks or more so that they can communicate. You can create only a single bridge network on a computer, but a bridge can handle any number of network connections.
You can try the steps at the bridge between two different routers wireless.
a. determine the coverage area. When using two or more routers, the coverage area should be divided, and each router should be placed in a central location in each subdivision. If you add a wireless router to an existing network, this may mean moving the first router.
b. decide which router is the main router. The main router is connected to the Internet, a LAN cable or other networks. It should be as close to the wired network connections or who has the best line of sight to another wireless network. In addition, the main router should be a high range router, allowing large tables of State and more users.
c. buy a spare antenna, as the antennas that come with most routers do not have very good range. Quality omnidirectional antennas can push the range and signal strength of each of the routers, which, in turn, will reduce the cost by allowing routers less cover more space overall.
d. deploy the primary router carefully. This router is the most important and requires most of the time of installation and options. Set the WEP (Protocol) encryption Service Set Identifier (SSID) and wireless, set up the Internet connection and test the router with some clients (computers). Once you get the main router deployed, deploy other routers should be easy.
e. deploy the secondary routers, which must be configured to operate in "mode of transition." Secondary routers should be deployed around the perimeter of a large area or 'hot spots' where users placed - for example, will convene a bench Park or the table.Links:
Create a network bridge:
http://Windows.Microsoft.com/en-us/Windows7/create-a-network-bridgeAdd a connection to a network bridge:
http://Windows.Microsoft.com/en-us/Windows7/add-a-connection-to-a-network-bridgeHope this information helps you. If you need to get help or information with decision-making wireless bridge between two different routers, I'll be happy to help you.
-
Connect between two different applications. A call to the other application.
I would like to know if it is possible to connect between two different applications in oracle apex IE appeal one request for the other? If the applications are allowed even say LDAP.
Yes,
Refer to the post office, requested by me and answered by fac586
How to use one login for all applications in one only workspace
-
Utility FNDLOAD between two different servers
Hi friends,
For the phase of the UAT of our project, we have a new server (server with RedHat Linux ES4 HP).
We need to migrate reports form the unfounded (IBM - AIX 5.3 p) server to the new.
FNDLOAD works between two different servers?
If not, please tell me the reason why it doesnot work between servers.
I would also like to know if there is a way to migrate data between two servers.As indicated in the documentation, it does not work between servers. You export the metadata and get an output file. Then, you take the output file and transfer it to the new source. Complete with examples, including the necessary part of XDOLoader.
-
I have 3 tables to know
CUREPRESSMASTER,
CUREBLDGMACHINECONDITION,
NAMINGMASTER
with the structure of each table as
CUREPRESSMASTER: -.
CUREPRESS CHAR (5)
PRESSTYPE TANK (8)
CURINGGROUP CHAR (2)
examples of data
"CUREPRESS" "PRESSTYPE'"CURINGGROUP ".
'M02' "HAM OF 63.5" "31".
"M03" "HAM OF 63.5" "31".
"M04" "HAM OF 63.5" "31".
"M05" "HAM OF 63.5" "31".
"M06" "63.5" "31".
"M07" "HAM OF 63.5" "31".
"S03" "63.5" "31".
"S04" "HAM OF 63.5" "31".
"S05" "HAM OF 63.5" "31".
CUREBLDGMACHINECONDITION: -.
GROUPID (2) TANK
MACHINENAME CHAR (5)
DATA01 CHAR(10)
DATA02 CHAR(10)
Samples: -.
'GROUPID' "MACHINENAME" "DATA01" "DATA02.
'30' 'M03' "63.5" "UNDER".
'30' 'M04""63.5""UNDER ".
'30' 'M05""63.5""UNDER ".
'30' 'M06""63.5""UNDER ".
'30' 'M07""63.5""UNDER ".
"30" "M08" "63.5" "UNDER".
NAMINGMASTER: -.
IETS1 CHAR (1)
CLASSEMENT2 CHAR (2)
CERTIFICATE3 TANK (2)
NAMING2 CHAR (10)
Samples: -.
"IETS1" "CLASSEMENT2" "CERTIFICATE3'"NAMING2 ".
"0' '52" "31" "281".
'0' '69' "31" "110".
'2' '30' "31" "TBR".
"3' '30'"31""TIRE PLANT. "
"0' '51" "31" "261".
"A" "30" "31" "RP".
"A" "31" "31" "RP".
"H'" ""31""MTRLBhind. "
"J" "01" "31" ""
"L" "01" "31" ""
"G" " " "31" ""
"8" "" "31" "CambioMedi."
Now, I want to have all the rows of the table CUREPRESS left join with two other tables as specified below.
CUREPRESSMASTER. CUREPRESS = CUREBLDGMACHINECONDITION. MACHINENAME
CUREPRESSMASTER. CURINGGROUP = NAMINGMASTER. CERTIFICATE3.
Now I want to select the following columns as CUREPRESS, PRESSTYPE, NAMING2, DATA01 DATA02 after leaving the joints as shown above and curepress as primary key.
When I tried using a General left join she gave much more duplicate rows.
I have 100 lines in curepress, then I would have only 100 lines in the final result but I get my as 233 lines output, this may be due to CUREPRESSMASTER. CURINGGROUP = NAMINGMASTER. Certificate3 this condition.
Please suggest me some queries.This may be due to CUREPRESSMASTER. CURINGGROUP = NAMINGMASTER. Certificate3 this condition.
Yes. Because the above join result in one-to-MANY relationship. Look at your data
CUREPRESS PRESSTYPE CURINGGROUP --------- --------- ----------- M02 63.5 HAM 31 M03 63.5 HAM 31 M04 63.5 HAM 31 M05 63.5 HAM 31 M06 63.5 31 M07 63.5 HAM 31 S03 63.5 31 S04 63.5 HAM 31 S05 63.5 HAM 31 9 rows selected CLASSIFICATION1 CLASSIFICATION2 CLASSIFICATION3 NAMING2 --------------- --------------- --------------- ---------- 0 52 31 281 0 69 31 110 2 30 31 TBR 3 30 31 TIRE PLANT 0 51 31 261 A 30 31 PSR A 31 31 PSR H 31 MTRLBhind J 01 31 L 01 31 G 31 8 31 CambioMedi 12 rows selected
The value is 31 for all rows in the table two. And so 9 * 12 output will be 108 lines. Its one expected result how you expect to only 9 lines?
You can show us your results as well. I guess you are missing some basic business requirements. Show us your results.
-
How to get the value of EV - the diiference between two different columns
Hello
I get the difference between the two different columns of two different... as tables (emp.sal - dept.comm)... all I want is I need only the records that a negative gap how get this? Please help me
Thanks in advanceIf I understand your question right:
select case when emp.sal-dept.comm>=0 then YOUR_VALUE else emp.sal-dept.comm end difference_value from emp,dept...
or do you want to:
select ... from emp,dept... where emp.sal-dept.comm<0
?
Kind regards
Sayan M.Published by: xtender on 19.11.2010 22:29
-
How to share both calendars between two different iphones
My wife and I keep the personal calendars on each of our iPhones. We share Contacts through our main MacBook Pro, but we keep our calendars separately as our two different iPhones. My question is, we'd like to be able to see and share our calendars to the iPhone, but still keep our own separate calendars. (I hope that's clear). Is this possible and what can someone tell me the procedure to do it please. Thank you!
Hello ovelky,
Thank you for using communities of Apple Support.
Take a look at the following article. It explains how to use iCloud for sharing one calendar with others. This sounds just like what you are wanting to do.
iCloud: share one calendar with others
Best regards.
-
The space between two different paragraph style
Hello!
I'm working on a book, and I would like to first of all a standard space between two paragraph styles.
I have the paragraph of text and the reference point. I would like to put an extra space when a paragraph of text is followed by a reference point and vice versa.
I usually do it in html with CSS, it's like
p.text + p.citation {pad-bottom: 5px;}
My goal is to have a space between the text and citations, even if citations are multi point (and of course, without any paragraph empty additional)
Is this possible?
concerning
Lila
You probably need to two additional styles to represent the paragraph "first" that uses the text or styles of citation, with spacing before added, and text or reference style defined as following Style, like matches, for each, so that you can use for the first paragraph after a change. You can base teas on current styles and just add space.
-
Screen flashes like a strobe light between two different "parts".
Well, this is going to be hard to explain...
The short version: my screen is spazzy.
The long version: welp. It flashes like a strobe between two 'parts' as I call them. Part A is what I'm supposed to be viewing (browser, screen, scanner, antivirus, etc.) and part B being one of several things. The blue and black lines vertical, multicolored stripes, my desktop background. And it just flashes back. Sometimes when I move my mouse over the flashing area it goes back to what ever it is supposed to be (instead of my background OR task bar, it's just my taskbar) and, so, sometimes not. Sometimes, compounding the problem.
It's driving me crazy.
And not only it is completely in the path, it slows down my computer by my college courses online a pain in the thigh.
I ran Webroot SecureAnywhere, CCleaner and Defraggler. All to nothing does not.
Any help would be greatly appreciated. I'll even write a paragraph full dripping with disdain, if it's something stupid.
Original title: what the hell is happening with my screen?
HP provides the drivers for your computer.
If there is no Windows 7 graphics drivers available, there is nothing we can do to help you as a older laptop, graphics would be Onboard (part of the motherboard).
These are the two models for the number you provide:
HP Compaq nc6400 core Notebook PC model
I suggest that you ask in the HP Support Forums for further assistance with this:
Good luck.
-
Join between the tables with Order By
Hello
Sorry if my question has already been postponed. I Googled, but I can't find any solution.
This is the version of my DB: database Oracle 10 g Enterprise Edition Release 10.2.0.3.0.
I created 3 tables. They contain up to 4000 lines.
When I join without the order of closed I got a very quick response (less than 1 second), when I simply add Order By it gets more than 30 seconds!
The order is on a Date field from the first table.
Here's my query:
Select *.
tableOne tone
two tableTwo full outer join on tone.message_id = ttwo.message_id
outer join complete tableThree on two.field_id = tthree.field_id
tone.ts desc order;
I have some difficulties to export the plan to explain it...
Should I create any clue? where? on the orders of field? on the join field?
Any tips? Thank you.
NO, it would not be
Oracle does not work like that.
ORDER BY is always, really always done LAST.
ALWAYS.
The second statement is a JOIN EXTERNAL LEFT and not a FULL OUTER JOIN, so the results will be different.
Why "assume you' yours 'assumptions' are always right?
They are not. You were probably in your dipers when I was already performance in Oracle 6.0.33
--------------
Sybrand Bakker
Senior Oracle DBA
-
Left join with three-table join query
I am trying to create a query that left me speechless. Most of the query is simple enough, but I have a problem I do not know how to solve.
Background:
We have stock stored in i_action.
We have the attributes available for each type of action. The attributes available for each action are described in shared_action_attribute. Each type of action can have three attributes or none at all.
We have the values stored for the attributes in i_attribute_value.
An example says:
We have a transfer action (action_code B4). The action of B4 entry into i_action records the fact that the transfer took place and the date at which he spoke. The attributes available for a transfer action are the function code receiver, the receiving unit number and the reason of transfer code. These types of attributes available and their order are stored in shared_action_attribute. The actual values of the attributes for a specific action of transfer are stored in i_attribute_value.
Now i_action and i_attribute_value can be connected directly in action_seq in i_action and ia_action_seq in i_attribute_value. A left join on these two tables provides results for all actions (including actions that have no attributes) and assign values (see Query 1 below).
There are two questions. First of all, I want only the first two attributes. To specify the attributes of the first two, I also i_attribute_value a link to shared_action_attribute (which is where the order is stored). I can build a simple query (without the left join) which connects the three tables, but then shares without attributes would be excluded from my result (see Query 2 below).
The second problem is that I'd actually a row returned for each action with first_attribute and second_attribute in the form of columns instead of two lines.
The final query will be used to create a materialized view.
Here are the tables and examples of what is stored in the:
TABLE i_action
Name Type
----
ACTION_SEQ NUMBER (10)
DATE OF ACTION_DATE
ACTION_CODE VARCHAR2 (3)
VARCHAR2 (1) DELETED
EXAMPLE OF LINES
ACTION_SEQ ACTION_DATE DELETED ACTION_CODE
----
45765668 9 OCTOBER 09 B2 HAS
45765670 9 OCTOBER 09 BA HAS
45765672 B6 9 OCTOBER 09A
45765673 9 OCTOBER 09 B4 HAS
45765674 9 OCTOBER 09 G1 HAS
45765675 9 OCTOBER 09 M3 HAS
TABLE i_attribute_value
Name Type
---
IA_ACTION_SEQ NUMBER (10)
SACTATT_SACT_CODE VARCHAR2 (3)
SACTATT_SAT_TYPE VARCHAR2 (3)
VARCHAR2 VALUE (50)
EXAMPLE OF LINES
IA_ACTION_SEQ SACTATT_SACT_CODE SACTATT_SAT_TYPE VALUE
----
45765668 B2 COA 37 B
45765670 BA ROA D
45765670 BA ROR P
45765672 B6 CAT C
B4 45765673 RFC E
45765673 B4 TRC P
B4 45765673 RUN 7
45765674 G1 SS 23567
G1 45765674 ASG W
TABLE shared_action_attribute
Name Type
---
SACT_CODE VARCHAR2 (3)
SAT_TYPE VARCHAR2 (3)
ORDER NUMBER (2)
TITLE VARCHAR2 (60)
EXAMPLE OF LINES
SACT_CODE SAT_TYPE UNDER THE ORDER
----
B2 ACO 1 Office code
BA ROR 1 reason to re-open
Authority of BA ROA 2 reopen
B6 CAT 1 category
B4 RFC 1 reception function code
B4 RUN 2 receives the unit code
B4 TRC 3 transfer of reason code
Sequence of G1 SS 1 personal
Reason for G1 ASG 2 assignment
QUERY 1:
It's my current query as well as its results. Most are select simple but only one column is filled using the function analytic last_value (thank you guys). The last column in the view sub stores the value of the attribute. What I want is to replace this single column with two columns named first_attribute and second_attribute and eliminate all other attributes.
SELECT ia.action_seq, ia.action_date, ia.action_code cod,
NVL
(LAST_VALUE (CASE
WHEN ia.action_code = "G1".
AND iav.sactatt_sat_type = 'SS '.
THEN THE VALUE
WHEN ia.action_code IN ('A0', 'A1')
THEN '67089'
END IGNORE NULLS
) OVER (PARTITION BY ia.ici_charge_inquiry_seq ORDER BY ia.action_date,
IA.serial_number, ia.action_seq),
'67089'
) staff_seq,.
value
From i_action LEFT JOIN i_attribute_value iav AI
ON iav.ia_action_seq = ia.action_seq
WHERE ia.deleted = 'A ';
ACTION_SEQ ACTION_DA COD STAFF_SEQ VALUE
----
45765668 9 OCTOBER 09 B2 67089 37 B
45765670 9 OCTOBER 09 BA D 67089
45765670 9 OCTOBER 09 BA 67089 P
45765672 9 OCTOBER 09 B6 67089 C
45765673 9 OCTOBER 09 B4 67089 E
45765673 9 OCTOBER 09 B4 67089 P
45765673 9 OCTOBER 09 67089 7 B4
45765674 9 OCTOBER 09 23567 23567 G1
45765674 9 OCTOBER 09 G1 23567 W
45765675 9 OCTOBER 09 M3 23567
QUERY 2:
This query is limited to the first two attributes but he also filed actions which have no attributes, and it creates still several lines for each action instead of a single line with two columns for attributes.
SELECT ia.action_seq, ia.action_date, ia.action_code cod,
NVL
(LAST_VALUE (CASE
WHEN ia.action_code = "G1".
AND iav.sactatt_sat_type = 'SS '.
THEN THE VALUE
WHEN ia.action_code IN ('A0', 'A1')
THEN '67089'
END IGNORE NULLS
) OVER (PARTITION BY ia.ici_charge_inquiry_seq ORDER BY ia.action_date,
IA.serial_number, ia.action_seq),
'67089'
) staff_seq,.
value
OF shared_action_attribute saa, ims_action AI, ims_attribute_value iav
WHERE iav.ia_action_seq = ia.action_seq
AND iav.sactatt_sact_code = saa.sact_code
AND iav.sactatt_sat_type = saa.sat_type
AND saa.display_order IN ('1 ', ' 2')
AND ia.deleted = 'A ';
ACTION_SEQ ACTION_DA VALUE OF COD
----
45765668 9 OCTOBER 09 B2 67089 37 B
45765670 9 OCTOBER 09 BA D 67089
45765670 9 OCTOBER 09 BA 67089 P
45765672 9 OCTOBER 09 B6 67089 C
45765673 9 OCTOBER 09 B4 67089 E
45765673 9 OCTOBER 09 67089 7 B4
45765674 9 OCTOBER 09 23567 23567 G1
45765674 9 OCTOBER 09 G1 23567 W
I found it quite complex to try to write - I hope that I was clear.
Thank you very much!Hello
You can use an alias for column (such as staff_seq) in the ORDER BY. Unfortunately, it's the only place where you can use it in the same query, where it was defined.
You can use it anywhere in the super-requetes, however, so you can still work around this problem in assigning the aliases in a subquery and GROUP BY (or other) in a Super query, like this:WITH ungrouped_data AS ( SELECT ia.action_seq, ia.action_date, ia.action_code, NVL (LAST_VALUE (CASE WHEN ia.action_code = 'G1' AND sactatt_sat_type = 'SS' THEN VALUE WHEN ia.action_code IN ('A0', 'A1') THEN '67089' END IGNORE NULLS ) OVER (PARTITION BY ia.ici_charge_inquiry_seq ORDER BY ia.action_date, ia.action_seq), '67089' )staff_seq, (CASE WHEN display_order = '1' THEN VALUE END) first_attribute, (CASE WHEN display_order = '2' THEN VALUE END) second_attribute FROM i_action ia LEFT JOIN i_attribute_value iav ON iav.ia_action_seq = ia.action_seq LEFT JOIN shared_action_attribute ON sactatt_sact_code = sact_code AND sactatt_sat_type = sat_type WHERE ia.deleted = 'A' ) SELECT action_seq , action_date , action_code , staff_seq , MIN (first_attribute) AS first_attribute , MIN (second_attribute) AS second_attribute FROM ungrouped_data GROUP BY action_seq , action_date , action_code , staff_seq ;
There are other alternatives for special cases, but none of them work in this particular case.
-
Hello
I wrote the following example query,
SELECT a.acc_rk
A,.
b,
c
WHERE a.acc_rk = b.acc_rk
AND b.acc_rk = c.acc_rk;
Now I need to change equi join left join
I have the left join table 'a' with table "b".
and again, I have to make tables of left join 'b' and 'c '.
Can someone tell me how to do this.
Thank you
Radha KAJ99 wrote:
SELECT a.acc_rk FROM (a LEFT JOIN b ON a.acc_rk = b.acc_rk) LEFT JOIN c ON b.acc_rk = c.acc_rk;
There is no need for media. ;)
SELECT a.acc_rk FROM a LEFT JOIN b ON a.acc_rk = b.acc_rk LEFT JOIN c ON b.acc_rk = c.acc_rk;
-
Extracting data from table using the date condition
Hello
I have a table structure and data as below.
create table of production
(
IPC VARCHAR2 (200),
PRODUCTIONDATE VARCHAR2 (200),
QUANTITY VARCHAR2 (2000).
PRODUCTIONCODE VARCHAR2 (2000).
MOULDQUANTITY VARCHAR2 (2000));
Insert into production
values ('1111 ', '20121119', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121122', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121126', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121127', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121128', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121201', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121203', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121203', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20130103', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20130104', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20130105', ' 1023', 'AAB77',' 0002');
Now, here I want to extract the data with condition as
PRODUCTIONDATE > = the current week Monday
so I would skip only two first rows and will need to get all the lines.
I tried to use it under condition, but it would not give the data for the values of 2013.
TO_NUMBER (to_char (to_date (PRODUCTIONDATE, 'yyyymmdd'), 'IW')) > = to_number (to_char (sysdate, 'IW'))
Any help would be appreciated.
Thank you
MaheshHello
HM wrote:
by the way: it is generally a good idea to store date values in date columns.One of the many reasons why store date information in VARCHAR2 columns (especially VARCHAR2 (200)) is a bad idea, it's that the data invalid get there, causing errors. Avoid the conversion of columns like that at times, if possible:
SELECT * FROM production WHERE productiondate >= TO_CHAR ( TRUNC (SYSDATE, 'IW') , 'YYYYMMDD' ) ;
-
expdp and impdp between TWO different tables
DBVersion: 10g and 11g
I have two tables with the same data structure, same columnames and wide except name difference
orders and order_history
I got export orders for a date range and now want to import in order_history
What do I do? If so can you please provide me with the syntax
Thank youREMAP_TABLE:
http://docs.Oracle.com/CD/E11882_01/server.112/e22490/dp_import.htm#BABIGHCC
-
Several foreign key joins between two tables
Hello
I have a question about the creation of a repository.
I have a date and a fact dimension. The fact table has about 10 columns in foreign key to the date Dimension.
In this case I should create 10 aliases to create joins in the physical layer and MDB or y at - it another way to handle this situation.
I ask this question because 10 aliases can get very confusing for me at the later stage of time when creating reports.
With the help of OBIEE 10.1.3If you want to see in the industry as
End date, start date, date etc. nearby
you need to create 10 aliases for this purpose in the physical layer, make them drag in MDB and model, and then drag to the area of topicScore pls correct/good
Maybe you are looking for
-
Cannot close tab groups. Close button fails even with an empty window.
When I create groups of tabs, I can't close. The red X close tab group button does not work. I can resize, add or remove sites, or even remove all sites. But I can't get the button close the tab of the function group.
-
Wireless - hardware problem?
Hello world I have a laptop HP V3018CL. I have a wireless issue. I can not connect what either. But here's the weird part, I can't find my int Device Manager listed wireless card. I can't find in the Network Neighborhood properties. And the WiFi (in
-
Lenovo G560 2nd RAM slot does not recognize.
Hello. I bought 2 new of the straight plug of this computer - 1066 mhz 4 GB of Ram. After the installation of the 2 jacks, the computer recognizes only 1 card of 4 GB. I have the x 64 bit system. Also, I updated the BIOS. What can I do to fix this? T
-
My fingerprint sensor light does not illuminate. When I try to access Simple passage, the dialog box tells me to connect the sensor, but I don't have a clue how to proceed.
-
Restart issues after the automatic update
Same problem, the second time, after the updates for Windows 7 64 bit KB978207 1/23 and KB977074 on 1/28. Will not start windows after reboot, get nothing else than the famous blinking cursor. I must go into the bios setup and change the boot seque