How can we use the function of group based on time
Hai sirI had a table containing fields
EMPCODE NUMBER
EMPNAME VARCHAR2 (25)
BAR CODE VARCHAR2 (25)
VARCHAR2 (25) RESPONDENT
OUTTIME VARCHAR2 (25)
INTRTIMEIN VARCHAR2 (25)
INTROUTTIME VARCHAR2 (25)
PERTIMEIN VARCHAR2 (25);
PERTIMEOUT VARCHAR2 (25);
DATE OF ATTEND_DATE;
Who has six columns of time and I need to use the group function
For example
0815,0817,1230,1250,1645,1648,
0815 should store in timein
0817 must store in intrtimein
1250 need to store in pertimein
1230 must store in pertmeout
1645 must store in intrtimeout
1648 must store in the time-out period
If it is possible using max and min function pls tell me.
Thanks and greetings
Srikkanth.M
Hi, Srikanth,
It would help a Lopez, if you posted CREATE TABLE and INSERT statements for a few lines of sample data and the results desired from these data.
If you want a solution that works in your version of Oracle, say what is your version of Oracle.
Are you trying to sort columns?
In other words, you are waying that people can enter data in the six columns, in any order, and you want to reorder the values so that
respondent<= intrtimein="">=><= pertimein="">=><= pertimeout="">=><= introuttime="">=><=>=>
If so, you can unpivot data in 6 lines, use the ROW_NUMBER analytic function to number the lines in the order and their pivot then back in order:
MERGE INTO table_x dst
USING ( WITH cntr as
( SELECT LEVEL AS n
FROM dual
CONNECT BY LEVEL <= 6
)
, unpivoted AS
( SELECT t.empcode
, CASE c.n
WHEN 1 THEN intime
WHEN 2 THEN outtime
WHEN 3 THEN intrtimein
WHEN 4 THEN introuttime
WHEN 5 THEN pertimein
WHEN 6 THEN pertimeout
END AS tm
FROM table_x t
CROSS JOIN cntr c
)
, got_rnum AS
(
SELECT empcode
, tm
, ROW_NUMBER () OVER ( PARTITION BY empcode
ORDER BY tm
) AS rnum
FROM unpivoted
)
SELECT empcode
, MAX (CASE WHEN rnum = 1 THEN tm END) AS intime
, MAX (CASE WHEN rnum = 2 THEN tm END) AS intrintime
, MAX (CASE WHEN rnum = 3 THEN tm END) AS perintime
, MAX (CASE WHEN rnum = 4 THEN tm END) AS perouttime
, MAX (CASE WHEN rnum = 5 THEN tm END) AS introuttime
, MAX (CASE WHEN rnum = 6 THEN tm END) AS outtime
FROM got_rnum
GROUP BY empcode
) src
ON (dst.empcode = src.empcode)
WHEN MATCHED THEN UPDATE
SET dst.intime = src.intime
, dst.outtime = src.outtime
, dst.intrtimein = src.intrintime
, dst.introuttime = src.introuttime
, dst.pertimein = src.perintime
, dst.pertimeout = src.perouttime
;
It should work in Oracle 10 (and more).
The PIVOT and UNPIVOT features introduced in Oracle 11 can make it a little simpler.
Perhaps it would be better to require users to enter data in the right-hand columns.
You can use CHECK constraints to ensure that intimate<= intrtimein="">=><= pertimein="">=><= pertimeout="">=><= introuttime="">=><=>=>
Tags: Database
Similar Questions
-
How can I use the function 'compare' in Acrobat Reader ms?
I have the free version of Acrobat Reader DC.
Now, I want to use the function "understand" but I don't know how to buy that.
Buy only the function? Or do I have to buy the entire update?
Thank you very much!
This is part of the Acrobat Pro product. It cannot be added to Acrobat Reader. It is not an upgrade to Acrobat Reader - attention to not buy the upgrade, you won't be able to run it.
-
How can I recover the functions drag horizontal and vertical to center the portions of the image being developed?
1 - question double deleted
2 the name of the program you are using then a moderator may move this message to the correct program forum
This forum Cloud is not on the program problem... help a program would be Photoshop Lighroom or Muse or?
-
How can I use the Variance in FR
Hello
How can I use the formula of variance in financial reports.
I have in my grid 2rows
ColumnA CloumnB Cloumnc
1 2 4 10 total values
2 values 1 2 3
3
Now I need to include a 3rd place called variance in the how I can do this.
Please guide me the formula.
Thank you
I have wHi, HV,.
There is a default functions avilable in HFR to calecualate the Variance.
To do this, you have to select the line formula or the formula column.
in this column formla, you will be able to set these formulasConcerning
Sri -
I bought an iphone 4 on ebay but it's locked, icloud so I am not able to use it, and the previous owner is available to remove the device from their account: How can I use the appliance?
You can not. Try to return the unit and get your money back. There is absolutely no way for you to unlock the device,
-
How can I use the speed dial on my Motorola W490?
How can I use the speed dial on my motorola W490? I have followed the instructions on the manual book, but did not work.
The result, I received the screen is "unauthorized."
Pls help. THX.
Desiree-
Can you tell us what steps you took to set your speed dial and use it?
On page 61, you can find information about adding dial numbers to speed up and 62 mentions how you dial. For example if you have saved your Uncle Paul as Dáil speed 3, you simply hold the button 3 to call this contact.
Mark
Support Forums Manager
-
How can I use the same graph of façade in several events in a structure of the event?
I want to display my sensorDAQ signals in a graph.but I have more than one event in the case where the structure to acquire the signal and display it in the first round of graph.the is to acquire signals from threshold and its shown in the graphic as a feedback.after the first event is executed, I'll call the second event, where the other signals are acuired and compared with signals from threshold of event 1 my question is how can I use the same control on front panel in more than two events in the structure of the event? Please answer me I am stuck.
Hello
I have attached here an example of doing the same thing using local variables and shift registers. Take a peek inside. Shift register is always a better option than local variables.
Kind regards
Amine31
(Bravo to give good answers, mark it as a solution if your problem is resolved)
-
How can I use the copy of Windows XP from the desktop on the laptop?
loading xp with a different product code
I have a laptop that works under XP. I lost track of the original disc. I also have an office which was under XP but Win 7 is working now. I have the XP installation disc. How can I use the drive of the desktop on the laptop?
I dought you would get away with it. Try kb892130
Or the pc on a xp boot cd, reinstall xp with xp cd.
-
Windpws Mail & Wi - Fi
I just installed a TalkTalk wireless router which seems to have installed correctly. However when I try to send and receive e-mail using Windows Mail, she wants to use a made up connection. How can I use the wireless connection? Thank you very much, Dianthus MJ.
Go to tools | Accounts | Mail | Properties | Connection and check or change the connection properties. You will need to remove the account and then add it again, but try first and also check tools | Options | Connections.
Steve
-
How can I use the Media Center to watch video content on my smart TV
Separated from this thread.
How can I use the Media Center to watch live video content on my smart TV with Wifi. I couldn't find the instructions to do with Media Player, which I did not
Separated from this thread.
How can I use the Media Center to watch live video content on my smart TV with Wifi. I couldn't find the instructions to do with Media Player, which I did not
do you mean WiFi Direct or WiDi (wireless display)? If WiDi, you need Intel WiDi software installed on a compatible computer.
What brand of TV and the exact model? If you have Windows Media Center on your computer, you should have Windows Media Player. You can have it disabled in programs, but you can reactivate.
-
How can I use the signature keys in my bweb application works
Hi all
How can I use the signature keys in my web work BlackBerry application, I'm looking for video, guide, documentation, step-by-step flow link
Finally how to properly test it on a Simulator before giving the cod to the words App validation team
Thanks for your time
Hello
Have you seen the guides posted here?
What stage are you having problems with?
Erik Oros
BlackBerry Development Advisor
-
How can I disable the function on my v5 acer inspire?
OT : How can I disable the function on my v5 acer inspire where when you click on the mouse somehow your whole page disappears? It wasn't like this in one of my computers before windows 8.
How can I activate noff functionality of mouse that causes your entire page to disappear when you click on it the wrong way .i have an acer v5 inspire.please help. Ive had a lot of computers, but this feature never appeared until the windows 8
Please help its driving me crazy
James m
Hello
Thanks for posting your query on the Microsoft Community.
According to the description, I understand that you are facing problems with your mouse.
I suggest you to refer to suggestions of Mohammad_Imran replied on 5 April 2013 and check if that helps.
You can also check:
Hope this information helps. Please let us know if you need any other help with Windows in the future. We will be happy to help you.
-
Hello
How can I use the "fnd_user_pkg.updateuser" package to disable users in bulk?
in EBS R12.1.3, oracle 11g.
Please see the request for information of the user
-------------------------------------------------------------------------------------
SELECT
SEPARATE
FU. USER_NAME
FULL_NAME EMPLOYEE_NAME
, TO_DATE (LAST_LOGON_DATE, "dd/mm/rrrr") LAST_LOGON_DATE, end_date, FU.start_date
OF FND_USER FU, PER_ALL_PEOPLE_F PERX
WHERE 1 = 1
AND PERX. PERSON_ID = FU. EMPLOYEE_ID
AND SYSDATE BETWEEN PERX. EFFECTIVE_START_DATE AND PERX. EFFECTIVE_END_DATE
AND PERSON_TYPE_ID! = 1118 - excluded candidates iRec
AND LAST_LOGON_DATE < = TO_DATE (December 31, 2012 ', "dd/mm/rrrr") and end_date is null
ORDER BY TO_DATE (LAST_LOGON_DATE, "dd/mm/rrrr") / / desc
------------------------------------------------------------------------------------
Concerning
Ngoyi
Hello
You need to do the opposite of what the code in the discussion below is:
fnd_user_pkg. UpdateUser - End Date remove users
Kind regards
Bashar
-
How can I use the DC Acrobat Customization Wizard to include an Adobe ID sign in?
How can I use the DC Acrobat Customization Wizard to include an Adobe ID sign in? I want my users to install through our deployment tools without having to enter an email address and password after launching the software for the first time. Thank you.
This feature has always existed. In the Customization Wizard screen, fill in all fields and don't forget to click on "Grant offline Exception." This avoids having users connect to activate the product because the product is activated by the administrator on behalf of all users.
HTH,
Ben
-
I can´t use the function "save PDF-portfolio as a site" in the file menu - it is greyed out.
I use Windows 10 House and Acrobat DC
Not all portfolios can be saved as a site.
It is possible with http://blogs.adobe.com/pdfdevjunkie/wp-content/themes/Adobe_PDFDevJunkie/download/Billboar dTemplate.pdf
Maybe you are looking for
-
How can I stop receiving duplicate messages in all my mailboxes?
I have 5 different accounts. When a message appears in one of them, the same message appears in all the other 4. How can I fix this so that the message appears only in the box that it is addressed to?Thank youA franc
-
How can I access the Thunderbird spelling dictionary and make manual changes?
I have several bad words that have been added to the dictionary, and I want to delete them. How can I do?
-
The video is a video of Firefox. I can send a screen capture.
-
Hello Since yesterday, I use a Nighthawk R7500 and I can plug my devices. One is not connected, an IP DB-power cam. When you are connected by cable I have setup the cam using the configuration and the server DHCP the SSID and password and all other p
-
Lookout Web Export Controls Fail
Hello We have created a fairly advanced system for monitoring sensors of temperature among other things via a modbus and while I am able to see all the lookout controls inside Lookout itself, the minute I try and export of files to the web server Loo