Date Query Help
Version: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
Hello
I need help with an application Date to return the year from 2000 to 5 years from the current year.
The output for the year 2015 would be:
2000
2001
2002
...
2020
And in 2016, the result would be:
2000
2001
2002
...
2021
Thank you
Joe
Hi, Joe,
If you want to exit NUMBER, so here's one way:
SELECT 1999 + year LEVEL AS
OF the double
CONNECT BY LEVEL<= extract="" (year="" from="" sysdate)="" -="">=>
;
The 'magic number' 1994 is 2000 - (1 + 5). That said, you want to start with the year 2000 (including the year 2000, himself) and continue 5 years beyond the current year, in 2015, you want 21 lines of output.
EXTRACT (year FROM SYSDATE) - 2000
is only 15 when SYSDATE is in 2015, so you have more than 6 lines.
Tags: Database
Similar Questions
-
My iPAD asks me to update to OS 9.3, but the update fails because it says that the iPAD is not connected to the internet and when I connect to my computer iTunes it say my OS is up to date. Help, please.
I'm surprised to hear that for an iPad 2 that the issue had apparently been set for 2 s. Please see this for more details as I know them. Maybe the servers at your site have not been updated yet for the new version of the iPad 2. ???
Apple released the update iOS 9.3 for older devices (air of iPad and previous iPhone, 5 s and previous) due to problems with Activation. See the following for details and possible solutions.
http://www.IMore.com/Apple-working-iOS-93-fix-older-iPhone-iPad
https://support.Apple.com/en-us/HT206203
A new version for the iPad 2 is now available which does not require the activation step. A new version for other devices is not yet available.
-
I forgot my password and got my iphone disabled after several attempts. its display to connect to itunes, but I am unable to connect to itunes too. How can I unlock my phone without losing any data? Help, please
In short - you can't
IF you have a computer with iTunes on which you did a prior backup - the phone will be recognized and iTunes offer todo backup before it clears your device - that - except if you know the access code the content cannot be saved
-
I have a macbook pro: 2.3 GHz Intel Core i5, 4 GB of 1333 MHz DDR3 Ram. 10.7.5 version. When I open some websites, I get a message that web browser is obsolete. I use safari. When I do a software update, it says that the software is up-to-date. Help, please.
Safari maxes in a version of Mac OS x. New version of Mac OS x would be needed for the new version of Safari.
Firefox is not limited within an OSX and probably has a version that works. Chrome may as well but is a Devourer of resources. Opera is a third option.
-
How could a routine walk-run? Inside, Indoor walk or another run? I do this routine outdoors with Gps first so that I'm not kidding my calibration data? Help please and thank you!
Hello
Choose indoor walk or run Indoor (it does not matter which) to an indoor walk-run routine.
Even if Apple Watch does not currently offer as a workout interval training, choose one of these allows the most appropriate data sources (which are the same for market and short) to use to track your training.
If walking or running, the accelerometer is used to estimate pace and the distance (allow your arms swinging naturally) as well as the frequency heart sensor for the estimation of calories burned.
Run or walk inside will not affect your calibration data. Calibration is based on the GPS of the iPhone data and is only held during the outdoor walking training or race outdoors when the iPhone combined is taken along.
More information:
Use of the workout on your Apple Watch - Apple Support
Calibrate your Apple Watch for better accuracy of training and activity - Apple Support
-
error when opening application data\microsoft\help\qyevopl.dll.
Original title: I get a window rundll on opening how do SFC?
Be very specific when telling me how to do this. the box says application data\microsoft\help\qyevopl.dll
You also have to be precise!
If you receive an error rundll in opening, exactly what what would you say (be specific, not paraphrase).
It is extremely unlikely that SFC will help you, but you can if you want to get frustrated time and waste. If you have a genuine XP installation CD bootable which has the same Service Pack as your installed version (most people don't) SFC will complain - a lot and you will be in for a frustrating waste of time. Suggestin SFC is akin to saying "I don't know what the problem is or how to fix it.
There is no XP file called qyevopl.dll, so if that's what you're seeing, it sounds like your system is currently or has been affected by malicious software.
You should tell us about your system and then run some known for malware scanners.
It makes no sense to try to repair a system that is afflicted with malicious software, so if you still have the problem after scans run clean, then we can solve your problem.
Since the implementation of the Microsoft Answers forum does not ask for any kind of information system when a new question is asked, we know absolutely nothing about your system. Not knowing the basic information a problem prolongs the frustration and the agony of these issues.
Thank you MS Answers, allowing the resolution of simple problems as frustrating and a lot of time as possible.
Provide information on your system, the better you can:
What is your system brand and model?
What is your Version of XP and the Service Pack?
Do you have the Windows Desktop Search installed issue?
Describe your current antivirus and software anti malware situation: McAfee, Symantec, Norton, Spybot, AVG, Avira!, MSE, Panda, Trend Micro, CA, Defender, ZoneAlarm, PC Tools, Comodo, etc..
The afflicted system has a working CD/DVD (internal or external) drive?
You have a genuine XP installation CD bootable, which is the same Service as your installed Service Pack (this is not the same as any recovery CD provided with your system)?
What do you see (exactly) that you don't think you should see, and when you see it?
If the system works, what do you think might have changed since the last time it did not work properly?
Download, install, update and do a quick scan with these free malware detection programs (not at the same time):
Malwarebytes (MMFA): http://www.malwarebytes.org/products/malwarebytes_free
SUPERAntiSpyware: (SAS): http://www.superantispyware.com/SAS will probably report a lot of tracking cookies and you can just let him delete them.
They can be uninstalled later if you wish.
The scans by operating clean, restart, and then fix any problems.
-
Lightroom 6 suddenly very slow. All my changes drag on the screen at least + 10 seconds. The screen seems frozen between each edition. I use a macbook pro and all my programs are up to date. Help, please
Hi janeslens,
- Go to Lightroom > Preferences.
- Also please go to preferences > Performance tab and uncheck the box "use graphics processor.
- Restart Lightroom and see if it works.
- Please make sure you also update of Lightroom to the latest version, which is 6.3 Lightroom
Let me know if it helps.
Kind regards
Tanuj
-
In Muse miniature slideshow container, I have images where I can insert the data of image properties. SEO search engines see the data and help the visibility of my site?
Post edited by: Howard Lower and rewrote the question because I have yet to get a response.
Yes, they will be included in the report.
Please check these links:
https://helpx.Adobe.com/Muse/how-to/add-alt-text-and-ToolTips.html
https://forums.Adobe.com/thread/1747973?start=0&TSTART=0
Thank you
Sanjit
-
data query oracle simple summons please help.
Basically, I'm trying to get a number of people on columns. Im having a hell of a time acomplishing can someone throw me a BONE I know there must be a way to do this?
the closest I came to an answer she
is it
Here is the table structure and dataselect sum(managerCOUNT) manager, manager from ( select count(manager) managerCount, count(lead) leadCount, manager, lead from project_1 group by manager, lead )group by manager
create table project_1 ( manager varchar2(250), lead varchar2(250) );
INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('JAM', 'JAM') INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('PMA', 'JAM') INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('JB', 'JB') INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('SF', 'JB') INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('JAM', 'JB') INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('JB', 'JAM')
NAME MANAGER LEAD JAM 2 3 JB 2 3 PMA 1 0 etc... you get the idea
Hello
mlov83 wrote:
Basically, I'm trying to get a number of people on columns. Im having a hell of a time acomplishing can someone throw me a BONE I know there must be a way to do this?Thus, every person, whether a Manager or a lead or both, gets a line?
You probably have a table where there is one line per person, and a foreign key constraint allows you as only denter someone such as a Manager or a lead if they are already in the table. If you do not, you can generate a game on the fly, as I did below, but it's always a good idea to have a separate, real results table.the closest I came to an answer she
is itselect sum(managerCOUNT) manager, manager from ( select count(manager) managerCount, count(lead) leadCount, manager, lead from project_1 group by manager, lead )group by manager
Thanks for posting that! It is always useful to see what you've tried.
Here is the table structure and data
create table project_1 ( manager varchar2(250), lead varchar2(250) );
The LEAD is the name of a built-in function, is not a very good column name. Use something like leader or project_instead.
INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('JAM', 'JAM') INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('PMA', 'JAM') INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('JB', 'JB') INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('SF', 'JB') INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('JAM', 'JB') INSERT INTO "PROJECT_1" (MANAGER, LEAD) VALUES ('JB', 'JAM')
NAME MANAGER LEAD JAM 2 3 JB 2 3 PMA 1 0 etc... you get the idea
With the sample data you posted correct results do not include only 1 row? Which is much easier to say "etc... you get the idea" as saying:
SF 1 0
Here's a way to get the desired results:
WITH all_people AS ( SELECT manager AS name FROM project_1 UNION SELECT project_lead AS nmae FROM project_1 ) SELECT a.name , COUNT (CASE WHEN a.name = p.manager THEN 1 END) AS manager , COUNT (CASE WHEN a.name = p.project_lead THEN 1 END) AS project_lead FROM all_people a JOIN project_1 p ON a.name IN (p.manager, p.project_lead) GROUP BY a.name ;
-
Absent from the report data query
is the SQL code for the query: SELECT AD_Pref_none_pref_Arch_Domain. [Organizational units (uses)], AD_Pref_none_pref_Arch_Domain.Name, Count (AD_Pref_none_pref_Arch_Domain. [Standard and Regulation_Category]) AS CountOfPref, AS Count (AD_Pref_none_pref_Arch_Domain.Name) CountOfPNP, [CountOfPref] / [CountofPNP] AS PercentPref, ([CountofPNP]-[CountOfPref]) / [CountofPNP] AS RatioPNP
OF AD_Pref_none_pref_Arch_Domain
GROUP OF AD_Pref_none_pref_Arch_Domain. [Organizational units (uses)] AD_Pref_none_pref_Arch_Domain.name, [CountOfPref] / [CountofPNP], ([CountofPNP]-[CountOfPref]) / [CountofPNP]
HAVE (((AD_Pref_none_pref_Arch_Domain. [Organizational units (uses)]) like "E S SF" & "Q3Z get AD sum of Total P N P1
E S SF 1.1 data management 0 11 0.00% 100.00% E S SF 1.1.4 staff Master Data Management 0 1 0.00% 100.00% E S SF 1.1.5 product Data Management 6 9 66.67% 33.33% and the show report
R3Z get AD total P N p
E S SF 1.1 data management 0.00% 100.00% E S SF 1.1.4 staff Master Data Management 0.00% 100.00% E S SF 1.1.5 product Data Management 66.67% 33.33% Now I don't know what else to do. I have already created several queries to if I can find the problem, that the data displayed on the query, but once I have create the query report data is missing only the count data. Thanks for your help anyone.
Hello
SQL is not supported in these forums. I suggest you ask again in the dedicated Microsoft here SQL instance:
http://social.technet.microsoft.com/Forums/en-us/category/sqlserver .
Thank you. :)
-
Oracle 11g Release 2
Frank Kulash was able to help on this issue yesterday. But I got additional requirements. Details below.
CASE 1:
create table t
(key primary id number,)
supplier_id number,
number of supplier_desc_id
batch number,
date of dt_recv
)
/
Insert into t
values (35405,605,3809,0,TO_DATE('14-JUN-2013','DD-MON-yyyy')
/
Insert into t
values (58543,605,3809,0,TO_DATE('10-DEC-2013','DD-MON-yyyy')
/
Insert into t
values (136793,605,3809,1,TO_DATE('11-NOV-2014','DD-MON-yyyy')
/
Insert into t
values (96510,605,3809,1,TO_DATE('11-JUN-2014','DD-MON-yyyy')
/
Insert into t
values (94222,605,3809,1,TO_DATE('09-MAY-2014','DD-MON-yyyy')
/
Insert into t
values (108229,605,3809,3,TO_DATE('09-SEP-2014','DD-MON-yyyy')
/
Insert into t
values (114585,605,3809,2,TO_DATE('28-OCT-2014','DD-MON-yyyy')
/
commit;
Select * from t;
ID SUPPLIER_ID SUPPLIER_DESC_ID BATCH DT_RECV
---------- ----------- ------------------------ ----------------- -------------
35405 605 3809 0 14 JUNE 2013
58543 605 3809 0 10 DECEMBER 2013
3809 605 136793 1 11 NOVEMBER 2014
96510 605 3809 1 10 JUNE 2014
94222 605 3809 1 9 MAY 2014
108229 605 3809 3 09 - SEP - 2014
114585 605 3809 2 28 OCTOBER 2014
RULE: when there are 2 or more records with batch = 1, return the two most
recent recordings with batch = 1 AND any recording (no matter the batch) that
has a DT_RECV > = only the DT_RECV of the 2nd record most of batch = 1 (June 10, 2014)
96510 10 June 2014 (2nd most active record with batch = 1)
136793 11 November 2014 (more current label with batch = 1)
94222 may 9, 2014 (not interested in this matter, since it is greater than 2 versions)
The results should be:
ID SUPPLIER_ID SUPPLIER_DESC_ID STATUS_ID DT_RECV ---------- ----------- ------------------------ ----------------- ------------- 96510 605 3809 1 10-JUN-2014 136793 605 3809 1 11-NOV-2014 114585 605 3809 2 28-OCT-2014 >= 10-JUN-2014 108229 605 3809 3 09-SEP-2014 >= 10-JUN-2014 This query returns the correct results: WITH got_r_num AS ( SELECT id, supplier_id, supplier_desc_id, status_id, dt_recv , ROW_NUMBER () OVER ( PARTITION BY supplier_id,supplier_desc_id,status_id ORDER BY dt_recv DESC ) AS r_num FROM t ) , got_dt_cutoff AS ( SELECT id, supplier_id, supplier_desc_id, status_id, dt_recv , MIN ( CASE WHEN status_id = 1 AND r_num <= 2 THEN dt_recv END ) OVER (PARTITIN BY supplier_id,supplier_desc_id) AS dt_cutoff FROM got_r_num ) SELECT id, supplier_id, supplier_desc_id, status_id, dt_recv FROM got_dt_cutoff WHERE dt_recv >= dt_cutoff ORDER BY dt_recv ; NOTE: records are grouped by supplier_id/supplier_desc_id
CASE 2:
truncate table t; insert into table t values(45401,801300,4466,0,TO_DATE('21-AUG-2013','DD-MON-YYYY') / insert into table t values(44414,801300,4466,0,TO_DATE('08-AUG-2013','DD-MON-YYYY') / commit ; select * from t; CONTENT_ID SUPPLIER_ID SUPPLIER_CONTENT_DESC_ID CONTENT_STATUS_ID RECEIVE_DATE ---------- ----------- ------------------------ ----------------- ------------ 451 801300 4466 0 21-AUG-2013 44414 801300 4466 0 08-AUG-2013 801300 4466 0 08-AUG-2013
RULE: when there is no batch = 1, then return all rows
The query above does not work for this case.
CASE 3:
truncate table t; insert into table t values(29887,609051,1781,0,TO_DATE('19-APR-2013','DD-MON-YYYY') / insert into table t values(33623,609051,1781,0,TO_DATE('24-MAY-2013','DD-MON-YYYY') / insert into table t values(45477,609051,1781,0,TO_DATE('22-AUG-2013','DD-MON-YYYY') / insert into table t values(54013,609051,1781,1,TO_DATE('22-OCT-2013','DD-MON-YYYY') / commit; select * from t; CONTENT_ID SUPPLIER_ID SUPPLIER_CONTENT_DESC_ID CONTENT_STATUS_ID RECEIVE_DATE ---------- ----------- ------------------------ ----------------- ------------- 29887 609051 1781 0 19-APR-2013 33623 609051 1781 0 24-MAY-2013 45477 609051 1781 0 22-AUG-2013 54013 609051 1781 1 22-OCT-2013
RULE: When there is only to record with batch = 1, return all rows
The query above does not work for this case.
Hello
orclrunner wrote:
Oracle 11g Release 2
Frank Kulash was able to help on this issue yesterday. But I got additional requirements. Details below.
CASE 1:
create table t
(key primary id number,)
supplier_id number,
number of supplier_desc_id
batch number,
date of dt_recv
)
/
Insert into t
values (35405,605,3809,0,TO_DATE('14-JUN-2013','DD-MON-yyyy')
/
Insert into t
values (58543,605,3809,0,TO_DATE('10-DEC-2013','DD-MON-yyyy')
/
Insert into t
values (136793,605,3809,1,TO_DATE('11-NOV-2014','DD-MON-yyyy')
/
Insert into t
values (96510,605,3809,1,TO_DATE('11-JUN-2014','DD-MON-yyyy')
/
Insert into t
values (94222,605,3809,1,TO_DATE('09-MAY-2014','DD-MON-yyyy')
/
Insert into t
values (108229,605,3809,3,TO_DATE('09-SEP-2014','DD-MON-yyyy')
/
Insert into t
values (114585,605,3809,2,TO_DATE('28-OCT-2014','DD-MON-yyyy')
/
commit;
Select * from t;
ID SUPPLIER_ID SUPPLIER_DESC_ID BATCH DT_RECV
---------- ----------- ------------------------ ----------------- -------------
35405 605 3809 0 14 JUNE 2013
58543 605 3809 0 10 DECEMBER 2013
3809 605 136793 1 11 NOVEMBER 2014
96510 605 3809 1 10 JUNE 2014
94222 605 3809 1 9 MAY 2014
108229 605 3809 3 09 - SEP - 2014
114585 605 3809 2 28 OCTOBER 2014
RULE: when there are 2 or more records with batch = 1, return the two most
recent recordings with batch = 1 AND any recording (no matter the batch) that
has a DT_RECV > = only the DT_RECV of the 2nd record most of batch = 1 (June 10, 2014)
96510 10 June 2014 (2nd most active record with batch = 1)
136793 11 November 2014 (more current label with batch = 1)
94222 may 9, 2014 (not interested in this matter, since it is greater than 2 versions)
The results should be:
- ID SUPPLIER_ID SUPPLIER_DESC_ID BATCH DT_RECV
- ---------- ----------- ------------------------ ----------------- -------------
- 96510 605 3809 1 10 JUNE 2014
- 3809 605 136793 1 11 NOVEMBER 2014
- 114585 605 3809 2 28 OCTOBER 2014 > = JUNE 10, 2014
- 108229 605 3809 3 09 - SEP - 2014 > = JUNE 10, 2014
- This query returns the correct results:
- WITH got_r_num AS
- (
- SELECT id, supplier_id, supplier_desc_id, batch, dt_recv
- , ROW_NUMBER () OVER (PARTITION BY supplier_id, supplier_desc_id, batch)
- ORDER BY dt_recv DESC
- ) AS r_num
- T
- )
- got_dt_cutoff AS
- (
- SELECT id, supplier_id, supplier_desc_id, batch, dt_recv
- MIN (CASE
- WHEN batch = 1
- AND r_num<=>=>
- THEN dt_recv
- END
- ) ON (PARTITIN BY supplier_id, supplier_desc_id) AS dt_cutoff
- OF got_r_num
- )
- SELECT id, supplier_id, supplier_desc_id, batch, dt_recv
- OF got_dt_cutoff
- WHERE dt_recv > = dt_cutoff
- ORDER BY dt_recv
- ;
- NOTE: the records are grouped by supplier_id/supplier_desc_id
CASE 2:
- truncate table t;
- insert into table t
- values (45401,801300,4466,0,to_date('21-Aug-2013','DD-mon-YYYY')
- /
- insert into table t
- values (44414,801300,4466,0,to_date('08-Aug-2013','DD-mon-YYYY')
- /
- commit;
- Select * from t;
- CONTENT_ID SUPPLIER_ID SUPPLIER_CONTENT_DESC_ID CONTENT_STATUS_ID RECEIVE_DATE
- ---------- ----------- ------------------------ ----------------- ------------
- 451 801300 4466 0 21 AUGUST 2013
- 44414 801300 4466 0 AUGUST 8, 2013
- 801300 4466 0 AUGUST 8, 2013
RULE: when there is no batch = 1, then return all rows
The query above does not work for this case.
CASE 3:
- truncate table t;
- insert into table t
- values (29887,609051,1781,0,to_date('19-Apr-2013','DD-mon-YYYY')
- /
- insert into table t
- values (33623,609051,1781,0,to_date('24-May-2013','DD-mon-YYYY')
- /
- insert into table t
- values (45477,609051,1781,0,to_date('22-Aug-2013','DD-mon-YYYY')
- /
- insert into table t
- values (54013,609051,1781,1,to_date('22-Oct-2013','DD-mon-YYYY')
- /
- commit;
- Select * from t;
- CONTENT_ID SUPPLIER_ID SUPPLIER_CONTENT_DESC_ID CONTENT_STATUS_ID RECEIVE_DATE
- ---------- ----------- ------------------------ ----------------- -------------
- 29887 609051 1781 0 19 APRIL 2013
- 33623 609051 1781 0 24 MAY 2013
- 45477 609051 1781 0 22 AUGUST 2013
- 54013 609051 1781 1 22 OCTOBER 2013
RULE: When there is only to record with batch = 1, return all rows
The query above does not work for this case.
Want to get answers that work, or is it possible to get responses that cause errors?
Make sure that the INSERT statements you post too much work. Test (and, if necessary, correct) them before posting. All the instructions insert above have errors.
The query above (once you correct the spelling of PARTITION) returns all the lines after a date limit. It's always what you want, only the details of how calculated this date limit changed. In accordance with the new requirements, the closing date must be earlier than the actual lines dt_recv in there are not 2 (or more) with batch = 1 for any combination of (supplier_id, supplier_desc_id). All you have to do is change "r_num".<= 2"="" to="" "r_num="2" ,"="" when="" computing="" dt_cutoff,="" and="" return="" an="" impossiblly="" early="" date="" if="" there="" is="" no="" such="" row. ="" (i="" assume="" that="" dt_recv="" can="" not="" be="">=>
WITH got_r_num AS
(
SELECT id, supplier_id, supplier_desc_id, batch, dt_recv
ROW_NUMBER () OVER (PARTITION BY supplier_id
supplier_desc_id
batch
ORDER BY dt_recv DESC
) AS r_num
T
)
got_dt_cutoff AS
(
SELECT id, supplier_id, supplier_desc_id, batch, dt_recv
, NVL ( MIN (CASE)
WHEN batch = 1
AND = 2 r_num - not <=, as="">=,>
THEN dt_recv
END
) OVER (PARTITION BY supplier_id
supplier_desc_id
)
, TO_DATE ('1', 'J') - first DATE in Oracle
( ) AS dt_cutoff
OF got_r_num
)
SELECT id, supplier_id, supplier_desc_id, batch, dt_recv
OF got_dt_cutoff
WHERE dt_recv > = dt_cutoff
ORDER BY supplier_id
supplier_desc_id
dt_recv
;
If dt_recv can be NULL, it is a bit more complicated, but only a little. Post instructions INSERT (work) and outcomes if you would like to help with this scenario.
-
need help on creating pivot query
SELECT * FROM TEST1
----------------
VALUE OF PERSON COMPUTERNAME
COMP1 ABC 3
COMP2 ABC 5
COMP1 CAD 3
COMP3 CAD 5
COMP2 TES 1
COMP1 TES 5
COMP3 ABC 2
myQuery
----------------------------
Select the link null, label, value1 COUNT (VALUE)
from 'test1 '.
CONTROL group PER PERSON
Results
---------
Link label value1
- ABC 3
- CAD 2
- TES 2
My requirement
---------------
can we have something like that out using the concept of pivot? If so can you share an example query pls.
Link label value1
-ABC ORDI1, COMP2, COMP3
-CAD COMP1, COMP2
-YOUR ORDI1, COMP3
Hello
Subhash C-Oracle wrote:
need help on creating pivot query
SELECT * FROM TEST1
----------------
VALUE OF PERSON COMPUTERNAME
COMP1 ABC 3
COMP2 ABC 5
COMP1 CAD 3
COMP3 CAD 5
COMP2 TES 1
COMP1 TES 5
COMP3 ABC 2
myQuery
----------------------------
Select the link null, label, value1 COUNT (VALUE)
from 'test1 '.
CONTROL group PER PERSON
Results
---------
Link label value1
- ABC 3
- CAD 2
- TES 2
My requirement
---------------
can we have something like that out using the concept of pivot? If so can you share an example query pls.
Link label value1
-ABC ORDI1, COMP2, COMP3
-CAD COMP1, COMP2
-YOUR ORDI1, COMP3
This sounds like a job for LISTAGG:
SELECT NULL AS link
label
LISTAGG (comp_name, ',')
THE Group (ORDER BY ComputerName) AS value1
OF test1
GROUP BY label
;
If you would care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
Are you sure that the results you posted are what you want from data provided?
Is of the order of the elements in a significant list? In other words, when you say you want to get the results:
COMP1, COMP2
you'd be just as happy with
ORDI1, COMP2
? If the order is important, explains what this order.
-
SQL Query Help (not working not properly)
Hello everyone,
I use JDeveloper 12.1.2.0.0. I do a two-way communication using 3 tables, with links between them (and using schema HR).
In my example, I have something like:
Departments, employees, and the SalaryByJobs (I created this table where it shows a departmentd id, employee id, salary).
Whenever I click on one OR more departments, the employees up-to-date table by putting on the table, employees who belong to the selected department and the salaryByjob to put the jobs of the employees selected on the employees table.
So it's something like this:
The departments selected-> employees selected-> salarybyjbobs of these employees.
My query used (in the view) has the following code:
SELECT Employees.COMMISSION_PCT,
Employees.DEPARTMENT_ID,
Employees.EMAIL,
Employees.EMPLOYEE_ID,
Employees.FIRST_NAME,
Employees.HIRE_DATE,
Employees.JOB_ID,
Employees.LAST_NAME,
Employees.MANAGER_ID,
Employees.PHONE_NUMBER,
Employees.SALARY
Employees EMPLOYEES
WHERE (department_id IN (select * from THE (select cast (in_list(:variavel3) as mytableType) double) a))
Since I use the links, the employees table does not show anything at the beginning, so I added this to my query used to go: OR nvl(:variavel3,0) = 0
But now, whenever I try to select multiple lines, it gives me the invalid numbers and I don't understand why...
It's only one line of code and it is not in the bean.
Can someone help me?
PS - The bean will Department by Department, adds the departments with ',' and for each Department, gets employees who belongs to them.
My best regards,
Frederico Barracha.
The expression NVL (: variavel3, 0) = 0 is not correct. The data type of the return value of the NVL function is considered to be equal to the data type of the argument of 1 (that is, the data type of the variable binding: variavel3). You said that this variable contained a list separated by commas to ID, so the data type of the variable is VARCHAR2. As long as you compare the NVL expression of a number, you get 'Invalid number' exception, because Oracle expects a numeric data type on the left side of the comparison operator.
To avoid the exception "Invalid number", you can modify the expression by using one of the following options:
: variavel3 IS NULL
NVL (: variavel3, ' *') = ' *'
NVL (: variavel3, ' 0') = '0'
Option 1, so the simplest and clearest.
Dimitar
-
simple query help :)
I have table with date, customer number, salary... Now, I want to extract the total number of client whose salary is between 2000 and 3000 and deposited consistantly for the last 6 months.
Can someone help me with this...user12183668 wrote:
I used your query... its working well... but there are a few County for the date (NTC) which I am less than 6... .and I want to exclude these documents at the level of the query.How can I do this
By encapsulating the query as an interior view, something in this way:
select * from ( select empno ,count(distinct trunc(hiredate,'MM')) cnt from emp where sal between 2000 and 3000 and hiredate >= add_months (trunc(sysdate, 'MM'), -5 ) group by empno ) a where a.cnt = 6;
-
Get data query with java files
Hay,
I'm trying to get a list of data file by a query with CRMI or wcm to java.
My goal is to get list < DataFile > for the content by query server.
I can't find a function or a method to do this, I just success to get the metadata of the cdf fields.
I want to create objects that are customized from the cdf...
Please, can someone help me?
EranWhat service 11g SS_GET_ELEMENT_DATA? It doesn't seem to be documented but must dDocName as a parameter which is the CDF.
Jonathan
http://redstonecontentsolutions.com
http://corecontentonly.com
Maybe you are looking for
-
Modules are disabled after every start.
Add-ons are disabled after every start. I have to re - activate all add-ons after the start.
-
RAM 1 GB upgrade will increase the performance of the Satellite Pro M30?
My ram size is currenty 512 MB.I have the model Satellite Pro M30.As the old model, my laptop would be faster if I increase to 1 GB
-
Tecra A2: No DVD decoder
I have a laptop Tecra A2 which has been upgraded to Windows XP, all drivers are up to date except when I try to play a DVD in Media Player pop - up appears saying no compatible DVD decoder is installed on this computer. Is this a driver problem and c
-
Specific charge on Satellite P300 - 20G
HelloI have problem with this laptop.When I plugin adapter nothing happens.Laptop will not start.Is quite dead.Only after I plugin printer via USB, then light diods - plugin and load.Then I start laptop.Under Windows, when I unplug printer, laptop st
-
Do not know what more I can add. Maybe I should look into another program or place. I need to mark some items so I can view or even to find them & other people told me to bookmark them.