- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: SQL Teaser..easy points!!
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2001 06:29 PM
тАО11-26-2001 06:29 PM
Many records have identical values of C1, C2 and C3, but C4 may be different in each row. I want to do a "select unique C1, C2, C3 and any one C4, doesnt matter which one".
For example, lets say my table has:
C1 C2 C3 C4
a b c d
a b c r
a d c p
q w e r
q w e g
q w e g
I should get only 2 rows:
a b c d/r/p
q w e r/g
Any guesses?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2001 07:08 PM
тАО11-26-2001 07:08 PM
Re: SQL Teaser..easy points!!
group by C1,C2,C3
order by C1,C2,C3
would be what I would do, but I would get more than two rows.
C1 C2 C3 C4
-----------
a b c d
a b c r
a b c p
q w e r
q w e g
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2001 07:11 PM
тАО11-26-2001 07:11 PM
Re: SQL Teaser..easy points!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2001 07:18 PM
тАО11-26-2001 07:18 PM
Re: SQL Teaser..easy points!!
(with the distinct C1, C2 and C3).
Besides, I get an error saying that C4 must be listed in the group-by clause. (Informix Dynamic Server Version 7.31)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-27-2001 03:22 AM
тАО11-27-2001 03:22 AM
Re: SQL Teaser..easy points!!
Have you looked for something like a 'crosstab' concept or using PL/SQL to programmatically create this?
What database package are you using?
Share and enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-27-2001 06:11 AM
тАО11-27-2001 06:11 AM
Re: SQL Teaser..easy points!!
Well, I'm looking to this using pure SQL - even if it involves temp tables, outer joins and other such niceties.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-27-2001 02:26 PM
тАО11-27-2001 02:26 PM
Re: SQL Teaser..easy points!!
how about:
select distinct c1,c2,c3 from tablename;
???????
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-27-2001 06:10 PM
тАО11-27-2001 06:10 PM
Re: SQL Teaser..easy points!!
(It should be one of the valid c4's. Otherwise I would have just done a "select unique c1, c2, c3, dummy as c4 from tablename")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-28-2001 07:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-28-2001 07:19 PM
тАО11-28-2001 07:19 PM
Re: SQL Teaser..easy points!!
Jonas, you have me kicking myself for not thinking of that earlier.
Thanks a ton to all who chipped in.