in the query and parent/child relationship
WITH the data AS
(
SELECT '213NY1' lfrom, NULL, '215ZVD' mi lto, "215ZV9 ' id, 1 January 2014' sdate, January 2, 2014' edate, 3 January, 2014 'mdate' January 5, 2014 medate double UNION ALL.
Lfrom SELECT NULL, '215ZVD' mi, id "213NY1", "215ZV9" lto 4 January 2014 'sdate', 6 January 2014 edate, January 7, 2014 'mdate', 8 January 2014 medate double UNION ALL
SELECT '216TVZ' lfrom, NULL, "213JW7" e "217LVQ" id lto, 21 January, 2014 'sdate' January 9, 2014 edate, 10 January 2014 'mdate', 11 January 2014 medate double UNION ALL
SELECT lfrom "215Y71", "217LVQ" lto, mi, "216TVZ" id "213JW7", 22 January, 2014 'sdate' January 23, 2014 edate, 24 January, 2014 'mdate' January 25, 2014 medate double UNION ALL
SELECT '234IJF' lfrom, NULL, "234YU" e "3IUED" id lto, 26 January 2014 'sdate', 27 January 2014 edate, 28 January 2014 'mdate', 29 January 2014 medate OF double
)
some lines have parent/child relationship and some does not. for example, the first two query (data) are link together. online, the value of lto (215ZV9) corresponds to the id value
in line 1. the value of lfrom in row1 (213NY1) corresponds to the value of online id.
the same scenario occurs in rows 3 and 4. 5th doesn't have any line which is a child. tier 5 is a single parent
I want to WRITE a query that gives the following result.
Mid id initial_date final_date
=======================================
215ZVD 215ZV9 1 January 2014 "January 5, 2014"
"215ZVD 213NY1 7 January 2014" January 6, 2014 "
"213JW7 217LVQ 21 January 2014 ' 11 January 2014"
"213JW7 216TVZ 24 January 2014 ' 23 January 2014"
"234YU 3IUED 26 January 2014 ' 27 January 2014"
ONLY WHEN there is a parent/child relationship, initial DATE AND follow the final data WHAT such as
FIRST date of deadline DATE
< Mdate > < EDate > - for child
< SDate > < MEDate > - for parent
WHEN there is no relationship of parent/child (e.g. ONLY a parent ROW) THEN
FIRST date of deadline DATE
< SDate > < EDate-> parent
can someone help me write a query for the above output
with tt AS
(SELECT a.*,
ROW_NUMBER () ON LV (MIDDLE ORDER BY SDATE PARTITION),
CASE
WHEN ID = NVL (ADVANCE (lto, 1) OVER (PARTITION BY Middle ORDER BY sdate), LAG (lfrom) OVER (ORDER BY sdate Middle PARTITION))
THEN 1
END flg
DATA one
)
SELECT THE MIDDLE,
ID,
CASE
WHEN flg IS NOT NULL
THEN
CASE
WHAT LV = 1
THEN SDATE
WHAT LV = 2
THEN mDATE
END
Of ANOTHER sdate
END INITIALDATE
CASE
WHEN flg IS NOT NULL
THEN
CASE
WHAT LV = 1
THEN mEDATE
WHAT LV = 2
THEN EDATE
END
Of ANOTHER edate
END FINALDATE
TT;
Output:
-------------
MID ID INITIALDATE FINALDATE
213JW7 217LVQ 21 January 2014 January 11, 2014
213JW7 216TVZ 24 January 2014 23 January 2014
215ZVD 215ZV9 January 1, 2014 5 January 2014
215ZVD 213NY1 January 7, 2014 6 January 2014
234YU 3IUED 26 January 2014 January 27, 2014
Tags: Database
Similar Questions
-
parent/child relationship hirarchy
Hi everyone, consider the sample data
SELECT LFROM '1TR1Y6', NULL LTO, MID '11ZFDD', '21XHK7' double UNION ALL TID-
SELECT '1TR1YF' LFROM, LTO NULL, '11ZFDD' MI '21XHK5' TID FROM dual UNION ALL-
SELECT '1TR1X1' LFROM, LTO NULL, '11ZFDD' MI '21XHK8' TID FROM dual UNION ALL-
SELECT '1LSZX1' LFROM, LTO NULL, '11ZFDD' MI '1TR1YD' TID FROM dual UNION ALL-
SELECT LFROM "1LSZWQ", "21XHK7" LTO, MID '11ZFDD', '1TR1Y6' TID FROM dual UNION ALL-
SELECT LFROM "1LSZX2", "21XHK5" LTO, MID '11ZFDD', '1TR1YF' TID FROM dual UNION ALL-
SELECT LFROM "1LSZVG", "21XHK8" LTO, MID '11ZFDD', '1TR1X1' TID FROM dual UNION ALL-
SELECT LFROM "4LSSVG", "21XHK9" LTO "11AAA' MI '1TR1X1' TID double UNION ALL
SELECT "AAAAA" LFROM, LTO NULL, '11ABB' e, 'CCCCCC' double UNION ALL TID
SELECT "BATH" LFROM, 'CCCCCC' LTO, MID '11ABB', 'AAAAA' double UNION ALL TID
some of them have a parent/child releationship. for example, let take rank with LFROM = 1TR1Y6
1TR1Y6 (lfrom) corresponds to the fifth line with TID 1TR1Y6. TID 1TR1Y6 LTO COLUMN value corresponds to the first line TID (21XHK7)
It before these two LINES are IN a parent/child relationship.
lets take another example. LINE two WITH LFROM = 1TR1YF matches sixth RANK WITH TID 1TR1YF. the sixth LINE LTO COLUMN (21XHK5) corresponds to the SECOND TID of LINE.
Once again the parent child relationship. There are two lines that do not have the relationship of parent/child (ex. line 8)
Im trying to write a query that can partition the data in the middle column and find the parent/child relationship. the output of the above data should be
LTO LFROM MIDDLE TID FLAG
1TR1Y6 NULL 11ZFDD 21XHK7 1
1LSZWQ 21XHK7 11ZFDD 1TR1Y6 1
1TR1YF NULL 11ZFDD 21XHK5 1
1LSZX2 21XHK5 11ZFDD 1TR1YF 1
1TR1X1 NULL 11ZFDD 21XHK8 1
1LSZVG 21XHK8 11ZFDD 1TR1X1 1
1LSZX1 NULL 11ZFDD 1TR1YD 0
4LSSVG 21XHK9 11AAA 1TR1X1 0
ABDELKÉBIR 11ABB CCCCCC NULL 1
CCCCCC 11ABB AAAAA BATH 1
For simplicity, I posted the release with parent/child, side by side in the sequence. the order does not matter as long as the flag column (pull the column) is set to an appropriate value (1 if parent/child, 0 no parent/child)
the flag column value is derived from column to indicate the parent/child relationship was found.
I try using lead, the lag function but I have problem of sorting data from parent and child line could come at random order (they are not side by side).
It is therefore difficult to use lead because you don't know how many lines to carry forward.
can someone help me write a query that displays the output above
SELECT T1. LFROM,
T1. LTO,
T1. ENVIRONMENT,
T1. TID,
(
SELECT COUNT (*)
OF TBL T2
WHERE)
T2. TID = T1. LFROM
OR
T2. LFROM = T1. TID
)
AND T2. MI = T1. MID
) FLAG
OF TBL T1
/
LTO LFROM MIDDLE TID FLAG
------ ------ ------ ------ ----------
1LSZWQ 21XHK7 11ZFDD 1TR1Y6 1
1LSZX2 21XHK5 11ZFDD 1TR1YF 1
1LSZVG 21XHK8 11ZFDD 1TR1X1 1
CCCCCC 11ABB AAAAA BATH 1
1TR1X1 11ZFDD 21XHK8 1
1TR1X1 11ZFDD 21XHK8 1
1LSZX1 11ZFDD 1TR1YD 0
1TR1Y6 11ZFDD 21XHK7 1
ABDELKÉBIR 11ABB CCCCCC 1
1TR1YF 11ZFDD 21XHK5 1
4LSSVG 21XHK9 11AAA 1TR1X1 011 selected lines.
SQL >
SY.
-
Add an object 3d without parent/child relationship.
Hello
I have a scene of 3d picture control, I have two objects in there, but when I created the scene I had to use the add object invoke node objects in the scene, so there is a parent/child relationship between the objects, which means that if I move the parent, I also move the child object. Is there a way to create a scene with several objects without the parent/child relationship.
Thank you.
-Luis
Hello, I solved it by first moving the objects and then adding them to the scene. -Luis
-
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
-
Implementation of Parent / child relationships
How to define a group of elements (symbols placed on the stage) as children of another element. When I drag/select the Group of elements that are the children and drop them on top of the element that must be the parent, the relationship is not to be trained and the 'drop' is not currently permitted.
I guess I must be watching older videos because the tutorials I have seen has indicated that dragging a layer on top of the other in the assets Panel would lead the moved element becomes the child of the element on which it was abandoned, but this doesn't seem to work.
Thank you.
Andy.
Hi, Andy.
Yes, it should work, but there are some types of items that may not be parents, like Text and Image divs. You can try to draw a rectangle, then by dragging on it. If this does not work, let us know so that we can begin to study more deeply.
Thank you
-Elaine
-
Parent - child relationship constraint Unique 5.0 apex oracle
Oky so I will try to avoid duplicate values get inserted in the parent-child node.
So basically when there's a node parent (Mobile) I can't create same node with the same name.
Even for the child node, if there is a child node name there may be another named A.
Structure:
Mobile (parent) /Android (Child) /KitKat (subchild) (allowed)
Mobile/apple/ios(Now allowed Same Parent name)
Win7/Windows/win7(not allowed same child)
So a big child and the parent must be unique at any time.
create an index of single "TEST_UK" on tablename (parent_id, upper (child_name));
see this too for a case-insensitive unique constraint
-
use F8 &; F10 keys on the keyboard to run the query and save a form
I created a screen. Here I can save by pressing CTRL + S (written a validation key trigger) or the button Save, I placed.
Now the user want to F10 to save & key F8 to run the query.
How can I do? Should what trigger I write the code...
I use oracle 10g and oracle developer suite 10 g.
I have fmrweb.res as follows:-
9: 0: 'Tab': 1: "then on the ground."
9: 2: "Ctrl + Tab": 1: "then on the ground."
9: 1: "Shift + Tab": 2: "previous field.
9: 3: 'Shift + Ctrl + Tab': 2: "previous field.
85: 2: "Ctrl + U": 3: "clear the field".
38: 0: 'Up': 6: 'Up '.
40: 0: 'Down': 7: "Down".
33: 0: 'PG': 12: "scroll to top".
34: 0: "PageDown": 13: "scroll."
69: 2: 'Ctrl + E': 22: 'Edit '.
10: 0: "Enter": 27: «Back»
120: 0: 'F9': 29: "list of values".
76: 2: "Ctrl + L": 29: "list of values".
81: 2: 'Ctrl + Q': 32: "Exit".
75: 2: "Ctrl + K": 35: 'display keys '.
112: 2: 'Ctrl + F1': 35: 'display keys '.
83: 2: 'Ctrl + S': 36: 'engage '.
121: 2: "F10": 36: 'engage '.
114: 1: 'SHIFT + F3': 61: 'next primary key '.
115: 1: "SHIFT + F4": 62: "delete folder".
117: 1: "SHIFT + F6": 63: 'delete folder '.
115: 0: "F4": 64: "Double registration".
117: 0: 'F6': 65: "insert record".
119: 1: "SHIFT + F8": 66: "a next Recordset.
1005: 0: 'Down': 67: "then save.
1004: 0: 'Up': 68: "history".
40: 1: 'Shift + down': 67: "then save.
38: 1: "shift + up": 68: "history".
116: 1: "Shift + F5": 69: 'clear the block '.
116: 0: 'F5': 70: "block the Menu."
34: 1: "shift + page down": 71: 'then block '.
33: 1: ' shift + Pg. Prev ': 72: "previous block.
34: 2: "Ctrl + PG. Next": 71: 'then block '.
33: 2: "Ctrl + PG. Prev': 72: "previous block.
114: 0: "F3": 73: "duplicate field '.
118: 1: "Shift + F7": 74: 'clear form '.
118: 0: "F7": 76: "enter the query."
119: 0: 'F8': 77: 'execute the query. "
122: 0: 'F11': 76: "enter the query."
122: 2: "Ctrl + F11": 77: 'execute the query. "
112: 1: "SHIFT + F1": 78: "error to display.
80: 2: 'Ctrl + P': 79: 'print '.
113: 1: "SHIFT + F2": 80: "request Count".
123: 0: "F12": 81: "update file".
121: 3: 'Shift + Ctrl + F10': 82: "function 0".
112: 3: 'Shift + Ctrl + F1': 83: «Function 1"»
113: 3: 'Shift + Ctrl + F2': 84: «Function 2"»
114: 3: 'Ctrl + Shift + F3': 85: «function 3"»
115: 3: 'Shift + Ctrl + F4': 86: «function 4"»
116: 3: 'Shift + Ctrl + F5': 87: «Function 5"»
117: 3: 'Shift + Ctrl + F6': 88: «function 6"»
118: 3: 'Shift + Ctrl + F7': 89: «Function 7"»
119: 3: 'Shift + Ctrl + F8': 90: «Function 8"»
120: 3: 'Shift + Ctrl + F9': 91: «Function 9"»
113: 0: 'F2': 95: "list of tab Pages.
72: 2: "Ctrl + H": 30: "Help".
112: 0: 'F1': 30: "Help".
Please suggest...Hello.
First of all check that you have set "term" among others in the variable 'otherparams' in formsweb.cfg
For example:
otherparams = expression = term %
Then make sure that you put the correct path for the keyboard mapping file in the variable "term" as I wrote in the previous post.
Things should work as I did several times.
Best regards.
-
Effort using Outer join parent-child relationship
Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product
I have the following tables
In short, here is the dataCREATE TABLE "ADDPROJECT" ( "PROJID" VARCHAR2(30) NOT NULL ENABLE, "PROJNAME" VARCHAR2(30), "PROJSTARTDATE" DATE, "PROJENDDATE" DATE, "PARENTPROJID" VARCHAR2(30), "PROJTYPE" VARCHAR2(30), "PROJSTATUS" VARCHAR2(30), PRIMARY KEY ("PROJID") ENABLE ) CREATE TABLE "ALLOCATEASSOCIATES" ( "PROJID" VARCHAR2(30) NOT NULL ENABLE, "ASSOCIATEID" NUMBER(*,0) NOT NULL ENABLE, "ALLOCATIONSTARTDATE" DATE, "ALLOCATIONPERCENT" NUMBER(*,0), "ENDDATE" DATE, PRIMARY KEY ("PROJID", "ASSOCIATEID") ENABLE ) CREATE TABLE "ADDRESEARCHAREA" ( "RAID" VARCHAR2(30) NOT NULL ENABLE, "RANAME" VARCHAR2(30), "RASTARTDATE" DATE, "RAENDDATE" DATE, "PARENTRAID" VARCHAR2(30), "RASTATUS" VARCHAR2(30), PRIMARY KEY ("RAID") ENABLE ) CREATE TABLE "PROJECTTORAASSOCIATION" ( "RAID" VARCHAR2(30) NOT NULL ENABLE, "PROJID" VARCHAR2(30) NOT NULL ENABLE, "STARTDATE" DATE, "ENDDATE" DATE, "STATUS" VARCHAR2(30), PRIMARY KEY ("RAID", "PROJID") ENABLE ) insert into addresearcharea values ('ra1','raname1',to_date('04/01/2012','mm/dd/yyyy'),'','','Active') insert into addresearcharea values ('ra2','raname2',to_date('04/01/2012','mm/dd/yyyy'),'','','Active') insert into addresearcharea values ('ra3','raname3',to_date('04/01/2012','mm/dd/yyyy'),'','','Active') insert into addresearcharea values ('ra4','raname4',to_date('04/01/2012','mm/dd/yyyy'),'','ra1','Active') insert into addresearcharea values ('ra5','raname5',to_date('04/01/2012','mm/dd/yyyy'),'','ra1','Active') insert into addresearcharea values ('ra6','raname6',to_date('04/01/2012','mm/dd/yyyy'),'','ra2','Active') insert into addproject values ('proj1','projname1',to_date('04/01/2012','mm/dd/yyyy'),'','','Research','Active') insert into addproject values ('proj2','projname2',to_date('04/01/2012','mm/dd/yyyy'),'','','Research','Active') insert into addproject values ('proj3','projname3',to_date('04/01/2012','mm/dd/yyyy'),'','','Research','Active') insert into projecttoraassociation values ('ra1','proj1',to_date('04/01/2012','mm/dd/yyyy'),'','Active') insert into projecttoraassociation values ('ra4','proj1',to_date('04/01/2012','mm/dd/yyyy'),'','Active') insert into projecttoraassociation values ('ra2','proj2',to_date('04/01/2012','mm/dd/yyyy'),'','Active') insert into projecttoraassociation values ('ra3','proj3',to_date('04/01/2012','mm/dd/yyyy'),'','Active') insert into allocateassociates values ('proj1',1,to_date('04/01/2012','mm/dd/yyyy'),100,'') insert into allocateassociates values ('proj1',2,to_date('04/01/2012','mm/dd/yyyy'),100,'') insert into allocateassociates values ('proj2',3,to_date('04/01/2012','mm/dd/yyyy'),100,'')
Research areas: ra1, ra2, ra3
Void / areas of research for AM1: ra4, ka5
Void / areas of research for ra2: qxf6
Void / areas of research for ra3: -.
Projects - proj1, proj2.proj3
Mapping of the area of research projects
Proj1: ra1 and ra4
Proj2: ra2
Associate the allocation
Proj1: 1,2
Proj2: 3
I need to get wise effort search space and subarea displayed on the same row (if the project is also associated with the search of sub box)
The user must be able to choose a particular area of research and the results displayed accordingly
Results expected in the cases where no specific research field are selected
Production in the event of main search box is selected (for example:-ra1)EFFORT PROJECTID PROJECTNAME RANAME SUBRANAME 12.70 proj1 projname1 raname1 ra4 6.35 proj2 projname2 raname2 - - proj3 projname3 raname3 -
The expected results in the area of research case void are selected (for example:-ra4)EFFORT PROJECTID PROJECTNAME RANAME SUBRANAME 12.70 proj1 projname1 raname1 ra4
The query I wroteEFFORT PROJECTID PROJECTNAME RANAME SUBRANAME 12.70 proj1 projname1 raname1 ra4
The problems I am facingSELECT to_char( SUM( (MONTHS_BETWEEN( 1+LEAST( LEAST( LEAST( nvl(ar.raenddate,to_date('04/01/2100','mm/dd/yyyy')) ,nvl(pr.enddate,to_date('04/01/2100','mm/dd/yyyy'))) ,nvl(aa.enddate,to_date('04/01/2100','mm/dd/yyyy'))) ,sysdate), GREATEST( GREATEST( GREATEST( ar.rastartdate ,pr.startdate) ,aa.allocationstartdate) ,to_date('04/01/2012','mm/dd/yyyy'))) * aa.allocationpercent / 100 )) ,999.99) AS EFFORT, aa.projid AS PROJECTID, ap.projname AS PROJECTNAME, ar.raname AS RANAME, ar2.raid AS SUBRANAME FROM AllocateAssociates aa,ProjecttoRAAssociation pr,addProject ap,AddResearchArea ar, AddResearchArea ar2 WHERE pr.projid = aa.projid (+) AND aa.projid = ap.projid AND pr.raid = ar.raid AND ar.raid = ar2.parentraid (+) group by aa.projid,ap.projname,ar.raname,ar2.raid
1. I need to get a list of projects that are associated with the search box even if they have no allocation of project. Although I used the outer join, I don't get this result. I used the full outer join, but gave the expected result. (Since there are several tables to assemble. maybe something wrong to join to?) (in the above data, proj3 must also be displayed even if it doesn't have an allocation of project)
2. If a search box has more than one field of research, there are 2 entries for each sub research field even if the project has been associated with the search under a single box (in the above data, the proj1 has been associated with ra4 only, but the results display the ra4 and ka5)
3. the query shows two entries for the main research area and one for the research sub area (provided that the project is associated with the correct principal and under research field). But there should be just an entry in a space research containing the name of the two main and under research field
Please help me to solve these problems.
-
Problem with the query and date
I'm trying to show only the specific results in my query based on the following:
If the 'agreedate' is greater than today's date, less than 60 days, show it. Otherwise I don't want results.
I always get the results of the last year and I don't know why.
Here is my code:
<!-the value date today less than 60 days. This works and shows the correct date->
< cfset invitelimit = #now () # >
< cfset invitelimit = #DateFormat (DateAdd (would be ', - 60, invitelimit), 'dd-mm-yyyy') #.<! - query items from the db and try to catch only to those with a more agreedate then the invitelimit date - >
< name cfquery = "qinvite" datasource = "#Application.ds #" >SELECT DISTINCT * from team a
INNER JOIN followed b ON a.id = b.team_id
INNER JOIN termsagreement c ON a.login = c.loginWHERE c.agreedate > #invitelimit # AND b.comp_id = 0
Group By a.teamname
< / cfquery >
First of all. Confirm that the "argeedate" column is a datetime column. Not another type of data that would be much more difficult to work with.
Secondly, you should provide an appropriate database datetime value. The easiest way would be with the
tag. I.E.
WHERE
c.agreedate >
AND b.comp_id =
-
Number of lines on the query and export are different?
Hello
I'm kinda new to SQL Developer, but so far it has been very well. I came across a problem, but with a certain query I count the lines and get about 11 000 (which is what I expected), and then export the data to a csv file to download on another system, and somehow the number of lines is increased to 30,000? I tried several times and still get the same results, and I know that the extra lines should not be returned to request bythe they fail when uploaded to the other system.
Does anyone have any idea why this could be? The query is a union query, but it was fine before. Looks like a bug to me, but then again that I am a newbie.
Thank you
SteveThe recordtypeextract r table is not related to any other table. Link with another table and avoid the Cartesian join.
-
I NEED TO BECOME AN ADMINISTRATOR ON MY COMPUTER. MY HUSBAND IS THE SOLE DIRECTOR. AND IT ME AS A STANDARD USER AND PUT SAFETY ON ME. I CAN'T DO ANYTHING IN THE COMPUTER WITHOUT PASSWORD WHICH IT WONT GIVE.IS THERE A WAY TO SUBSTITUTE ME FOR HIM AND TO BECOME AN ADMINISTRATOR OR FIND HIS PASSWORD? IT IS JUST ANOTHER FORM OF CONTROL AND IM TIRED OF IT. Help!
http://support.Microsoft.com/default.aspx/KB/189126
"Microsoft's strategy concerning lost or forgotten passwords"
Microsoft cannot help you recover the passwords of the files and Microsoft who are lost or forgotten product features.
Read theBANNING of cracking of passwords information tools information provided in these forums in the thread above posted byBill fill MSFT, moderator
See you soon.
Mick Murphy - Microsoft partner
-
I have windows 8 and 7, two different computers. When I change a curfew on the WFS Web site, our computers do not receive the update and do not allow access monitored accounts. On the 7 machine, I go to Windows Live Family Safety Filter, hit the icon refresh at the top right and a popup says I already have the last parameters, or FS settings have been updated. but in no case can the user log on. When the monitored user tries to connect, a message says "your account has time restrictions... ». What's wrong???
Here are the parameters:
Hi Peter,.
Welcome to the Microsoft Community forums.
I understand when you do the curfew change on the site Web WFS, computers
do not get the update and not allow access to the monitored accounts as you have
two computer windows 7 and 8.
Please follow the response of the Rudi on July 13, 2012.
You can also go through the link on the safety of the familyKeep us updated on the results. -
using PIN messages to send the query and return data
I am working on an app that will send a request to another blackberry and return the data all via PIN messages. There is a user interface where the user selects the contact and start the PIN message with the request. There is a background application that listens to these requests. When we arrive, he must inform the user and allow them to send the requested data or reject the request. If they choose to send, it will undertake a PIN to the sender with the requested data, which will then be returned to the screen. Is it possible by using PIN messages, and if so, can I prevent their display in the list of messages?
You * can * remove PIN of the Inbox messages. For all purposes useful, this is just a specific instance of an ELECTRONIC message.
-
How the lack of dates online results of the query and convert the output
Hi Experts,
My inline query returns the data in this format
2-jan-2016 10 4-jan-2016 33 5-jan-2016 20 7-jan-2016 70 8-jan-2016 77
I want to display the output as
1-jan-2016 2-jan-2016 3-jan-2016 4-jan-2016 5-jan-2016 6-jan-2016 7-jan-2016 8-jan-2016 9-jan-2016 10-jan-2016 0 10 0 33 20 0 70 77 0 0
Can you please help me with query how over the missing dates, is it tier, collar or pivot?
Thanks in advance.
Kind regards
IVW
Hello
Is that what you are looking for?
WITH
SampleSet
AS (SELECT TO_DATE (' 2 January 2016', 'DD-mon-yyyy') dt, val 10 FROM DUAL)
UNION ALL
SELECT TO_DATE (' 4 January 2016', 'DD-mon-yyyy'), 33 FROM DUAL
UNION ALL
SELECT TO_DATE (' 5 January 2016', 'DD-mon-yyyy'), 20 FROM DUAL
UNION ALL
SELECT TO_DATE (' 7 January 2016', 'DD-mon-yyyy'), 70 FROM DUAL
UNION ALL
SELECT TO_DATE (' 8 January 2016', 'DD-mon-yyyy'), 77 FROM DUAL
)
sample_rn as
(
Select
DT
val
, dt - min (dt) (order 1) + 1 rn
2 line_no
Of
SampleSet
order by
DT
)
mindate as
(select min (dt) dt sampleset)
dates in the FORM
(
SELECT
DT + level 1 - dt
null val
level rn
1 line_no
Of
MinDate
CONNECT BY ROWNUM<= 10 ="" --="" number="" of="">=>
)
a, as
(
Select
to_char Col (DT)
rn
line_no
Of
dates d
Union
Select
to_char Col (Val)
rn
line_no
Of
sample_rn
where
RN<= 10 ="" --="" number="" of="">=>
)
Select
*
Of
a pivot (pass the max (col) of rn (1,2,3,4,5,6,7,8,9,10))--liste of columns 1 to))What makes a list with 2 rows. Line 1 has dates starting with the first data of sampleset. and line 2 has the values. The number of columns, you can determine yourself.
Kind regards
Peter
-
Need help with the query and output
I have a table that contains a list of property and each an asset contains a category field, each an asset can have several categories assigned, then the category column is filled in a list (for example, 14, 16, 17, 19).
The values are based on a table of categories using the primary key as a reference number (for example 14 = keyboards, 16 = Trackballs, etc..)
I tried to understand how the power of categories so that when the category is displayed, the list will appear under the name of the category as opposed to the non referenced.
example:
< name cfquery = "qIndex" datasource = "#appDSN #" >
SELECT Asset.Reference, Asset.AssetName, Asset.Category
Assets
WHERE category LIKE ' %#URL. Category #% '
< / cfquery >
< cfoutput query = "qIndex" >
#Asset.Reference # < br / >
#Asset.AssetName # < br / >
#Asset.Category #.
< / cfoutput >
Exhibition:
AD_987738
Keyboard XYZ
11, 14, 17, 18
Table for categories are:
CatID = primary key
Category = category name
CatImage = header Image
Thanks for any help.Finally figured this out. Had to insert an intermediate query within the output to filter each record, otherwise he was out the results of the first record only and repeat.
SELECT *.
Assets
WHERE category LIKE ' %#URL. Category #% '
SELECT the CATEGORY, AssetID
Assets
WHERE assetID = #qIndex.AssetID #.
Category category WHERE CatID IN (#catids #)
Category:#qCat.Category #,
#qIndex.Asset #.
#qIndex.Reference #.
Thanks again for the help.
Paul
Maybe you are looking for
-
IPhone 6 s, after installing iOS 10. I can open is no longer an E-mail
I have a 6 s, after the upgrade iPhone to iOS 10. I can no longer open E-mails
-
HP 15: Code system off go 15 HP
Deactivation of the system code 51440135
-
Sony CCD-TR705E, transfer VideoHi8 to computer
Please help me! I have an old Sony video Hi8 Handycam CCD - TR705E PAL (Europian version) with a large number of bands that I need to transfer to my computer with the DVD. What do I need? I'll be able to transfer because it is PAL? Thank you much in
-
HP 6830: HP 6830 printing problems
Initially, this printer has been used on a system with Windows 8.1 (64-bit) and it worked flawlessy. After the upgrade to Windows 10 However, he had a few intermittent printing problems. Known upgrades can cause problems I uninstalled/reinstalled and
-
How can I extend the time before my computer disconnects me. Seems after 10 minutes or so, it disconnects automatically. It's very annoying when I play a movie ot a game.