Replace repeating lines with white and don't show the distinct values
Hi allI have a SQL query that looks like this:
SELECT Item_id, item_details, category, group INC.
OF my_items
WHERE THE...
The results are as follows:
Item_id item_details category group
001 keyboard PC - 1 Grp1
001 keyboard PC - 2 Grp1
003 monitor PC - 1 Grp 1
003 monitor PC - 2 Grp 2
What I really want, it's like to have repeated as a draft values and keep only the distinct values. I want the output to be like this:
Item_id item_details category group
001 keyboard PC - 1 Grp1
PC-2
003 monitor PC - 1 Grp 1
PC - 2 Grp 2
Is there a way we can do that? Help, please
Here's a way using the Lag as mentioned by Tubby...
SQL> ed
Wrote file afiedt.buf
1 with t as (select '001' as item_id, 'keyboard' as item_details, 'PC-1' as category, 'Grp1' as grp from dual union all
2 select '001', 'keyboard', 'PC-2', 'Grp1' from dual union all
3 select '003', 'monitor', 'PC-1', 'Grp1' from dual union all
4 select '003', 'monitor', 'PC-2', 'Grp2' from dual)
5 -- end of test data
6 select decode(item_id, lag(item_id) over (partition by item_id order by category, grp), null, item_id) as item_id
7 ,decode(item_details, lag(item_details) over (partition by item_id order by category, grp), null, item_details) as item_details
8 ,decode(category, lag(category) over (partition by item_id order by category, grp), null, category) as category
9 ,decode(grp, lag(grp) over (partition by item_id order by category, grp), null, grp) as grp
10 from t
11* order by t.item_id, t.category, t.grp
SQL> /
ITE ITEM_DET CATE GRP
--- -------- ---- ----
001 keyboard PC-1 Grp1
PC-2
003 monitor PC-1 Grp1
PC-2 Grp2
SQL>
Tags: Database
Similar Questions
-
I had to update my windows computer and you can no longer open Photoshop cs2. trying to find help with this new system is not easy to use to put it kindly. I downloaded the program and don't have the available key. I tried to sign in but where.
For Photoshop CS2 activation has been reprocessed, so your original drive and the serial number does not work.
As an owner of CS2, Adobe has a copy without activation and serial number, to which you are entitled.
The serial number is to the right of the download link for Windows. You'll need this one, not your old number.
Get them here: download Acrobat 7 and CS2 products
-
My husband doesn't like the itunes account is under my name. I have a way that he can have his own name and sign on with her and still exist on the family account? Also, have we HAVE two-step verification? It's a real pain.
Yes it can have its own ID and share your content via the family sharing, he needs to sign out of your ID and to create his own, then one of you needs to invite another family sharing.
You don't need to use 2 verification step, if you want you can disable to my Apple ID
-
original title: directxdiagnostic
Hello
To check the Version of DirectX with directxdiagnostictool, I don't see the Advanced button or troubleshooting. I signed up as an administrator. Clues or suggestions on how to make this tool available in case I need? Vista Home Premium with IE9 is installed.
Thank you very much.
Allie
Hi, Allie,
Tool changed with Windows Vista. If a problem is identified, it will appear in the box - Notes
http://Windows.Microsoft.com/en-us/Windows-Vista/run-DirectX-Diagnostic-tool
Troubleshooting tools and strategies
-
BlackBerry smartphones to change the BlackBerry ID user name and don't remember the password
To change the user name of BlackBerry ID and don't remember the password.
The current username email is not valid. Cannot retrieve recovery password email...?
What should I do to solve this problem. I'm 9 attempts to connect. I want to access apps...?
Hi @lionel1956
Performs a backup with Desktop software...
-
still no luck with highlighting and try to use the Edit with photoshop elements Editor
still no luck with highlighting and try to use the Edit with photoshop elements Editor.
Yes, I clicked the change of use with photoshop elements, editor in Chief but still, don't put not to...
region and I select view selected in organzier files. I don't understand what is happening. I never had this problem before and I have 12 for a long time. How can I fix it?
You can keep answers to the original discussion, or it's going to go very confusing - http://forums.adobe.com/thread/1438997?tstart=0.
See you soon,.
--
Neale
Insanity is hereditary, get you your childrenIf this post or by post from another user solves the original problem, please mark as correct and/or useful messages accordingly. This helps other users with similar trouble getting answers to their questions more quickly. Thank you.
-
I am not able to download apps for my iPhone on the App Store. He just 'waiting '. But never starts the download. I tried with wifi and mobile data. The two are not downloading the applications Can u find out what's wrong? I use iPhone 5s
I had the same problem. At the same time hold the screen lock button and the home button until your iPhone restarts. That solved the problem for me.
-
Why is the Google toolbar always uncompilable with ff5 and his long, since the introduction of ff5, why do u not have this fixed
You are welcome.
Please click the button solved it next to the answer that meets or solved your problem of Firefox support, it appears when you are connected, so this thread is marked as solved to help other users who may have this same problem.
-
0 x 80240036 get this error code and don't do the update.
0 x 80240036 get this error code and don't do the update. Message says "the website has encountered a problem and cannot display the page you are trying to view. The options provided below may help you solve the problem. Ive tried for three days to do the update and I tried at home and at the office, but I get this message.
I have updated to internet explorer 8, and then it worked.
-
I recently got a new labtop and there was already an admin account and a guest won't be able to access admin one I used the prompt, its my labtop but the person known not more because it is a gift, so is it every way possible to clear all the stuff off this or just be able to access the administrator account
The laptop has the option to restore to day? Some come with a disk partition to do that, while others came with BONES and CD drivers (or the ability to create).
If it came from someone else, it's always a good idea to wipe it and start over anyway; not sure what this person was in, or what are the sites he visits. Would not be a good day for you if the black helicopters landed in your front yard to cause something that accesses the internet of this laptop without realizing you it :-(
SC Tom
-
Security
I need to put in place the security of the laptop running finance and don't know the programs and the finest details of it. I need to buy, sell and subscribe. I need to use programs such as paypal also.You have antivirus installed? If this isn't the case, I would install Microsoft Security Essentials (MSE) for you antivirus protection.
http://Windows.Microsoft.com/en-us/Windows/products/security-essentials
Windows 7 is really quite safe as is and does not need a lot of work to ensure. There are a few FixIt who can put in place and ensure that it is set using the recommended security settings.
http://support.Microsoft.com/mats/windows_security_diagnostic/en-us
http://support.Microsoft.com/mats/Malware_Prevention/en-us
http://support.Microsoft.com/mats/ie_performance_and_safety/en-us
Just run the fix it is and install MSE and you should be sure resonably.
-
my windows xp does not start and it only shows the arrow and a black screen in the Middle, what can I do to solve this problem.
Try to restart your machine and pressing F8 before the spash screen Windows appears. Choose the option "last last known good configuration".
If this fails, you can try to repair your installation of starting for the original CD-ROM for Windows XP installation and choosing the option 'Fix' when prompted.
-
When I try to view my devices to Control Panel/hardware and Sound/devices and printers. It treats forever and does not show the devices. I need help!
Original title: device and Printers windowThere could be various reasons why the window devices and printers stalls. All the control points are listed here. -
DB_CONFIG documentation says that the lines with white spaces are ignored
Berkeley DB is used for a long time and just noticed something when I was reading the docs for the latest version (Berkeley DB 12 c Release 1, version of the 12.1.6.1.26 library: (June 16, 2015)). The documentation for DB_CONFIG (http://docs.oracle.com/cd/E17076_04/html/programmer_reference/env_db_config.html) contains the following sentence: all empty lines or lines whose first character is a space or hash character (#) is ignored.
This is false. The lines that begin with white space are not ignored. All leading white space are skipped until the line is checked to see if it is empty or the first character of the other is a hash character.
I went back and checked a few old versions of Berkeley DB. Docs and code reading DB_CONFIG did did not match for a very long time. Did not come back through all the old versions of Berkeley DB to see if they have ever matched.
We checked this and found that leading whitespace is ignored. We will update docs accordingly. Thank you for this comment.
Thank you
Mike
-
Choose straight line with METER and MAX works / help
Hello
I did a small database for a Bank model. I have 2 tables. Customers and customer representatives (customer_reps)
2 tables are related to eachother with customer REP ID (cust_rep_id)
It's my 1st request that gives me the total number of customers that each Cust. A. and Cust Rep. Names of Rep.
SELECT r.name, r.lname, COUNT (*)
From customers c, customer_reps r
WHERE c.cust_rep_id = r.cust_rep_id
R.lname GROUP, r.name
My 2nd query gives me the count of the total number of clients of the Cust. REP that has the largest number of customers. But this query gives only the total number
SELECT MAX (CNT) OF
(SELECT r.name, r.lname, COUNT (*) NTC
From customers c, customer_reps r
WHERE c.cust_rep_id = r.cust_rep_id
R.lname, r.name)
I want to write a query that gives me a result of 1 row naming "Cust." REP"with the largest number of clients and"total customer number"... by reading the forums I ve learned how use Count in a MAX function but not yet enough to display the result I want... any suggestions? and pls with explanation, I don't want to just copy paste... you want to learn logic...
Edited by: mtyson 16:30 04.Oca.2010'a' is just an alias, you can use max like this...
SELECT *.
(SELECT r.NAME, r.lname, COUNT (*) NTC
From customers c, customer_reps r
WHERE c.cust_rep_id = r.cust_rep_id
R.lname GROUP, r.NAME
ORDER 3) a
WHERE a.cnt = (SELECT MAX (NTC)
(SELECT r.NAME, r.lname, COUNT (*) NTC
From customers c, customer_reps r
WHERE c.cust_rep_id = r.cust_rep_id
R.lname, r.NAME))
Maybe you are looking for
-
How to concatenate the string of normal worksheet to srting
Hello I try to concatenate string worksheet to sring normal, but she cannot concatenate... here, I have attached my program for your firm .the support cannot be CONCATENATE.
-
Bad Virus infection. Need help please!
My laptop (Dell MS 1350 operating Windows XP Pro, sp2) became infested with a very bad virus. The symptoms were:1. many programs did not more open with an error message "..." exe is not a valid win32 application ".2. no programs of virus removal, inc
-
The Deskjet D2360 driver installation error
Came across the problem, try to install the driver for HP Deskjet D2360 (same error for small size and size driver CD) "The system does not have the specified path. and the screen thereafter I installed this driver on several other PCs with no proble
-
-files ctk.vmdk keep coming back.
Hey guys,.I have problems with the ctk files - keep reappearing. I am aware that this has to do with the change block Tracking (CBT) but I need it disabled. With this licence, I am unable to properly use VMWARE JETTÉ TOOL COMMENTS BACK (get them).
-
first_website_pt2 where is the total text box
I'm doing this tutorial. Create your first website - part 2: creating the structure of the page. Adobe Developer ConnectionStep 8 of part 2 (the link above) says:In the text box the title of the Document at the top of your new document, type beat Bay