473,395 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how can i select one row out of duplicates in a table.

lets say i have a table C with following columns-
C1 C2 C3
1 2 3
1 4 9
2 3 1
1 4 7
3 9 6
1 1 1
2 2 2
3 3 3
now i want max value of c2 column corresponding to values c1 column.
means for c1= 1 max c2 = 4
but we have two values for c1=1 and c2=4. here i want any of the two values..

so the final out put would look something like this -

C1 C2 C3
1 4 7
2 3 1
3 9 6

first I used select c1,c2,c3 from C where (c1,c2)in (select c1, max(c2) from C group by c1);

but i was getting the out put...
c1 C2 C3
1 4 7
1 4 9
2 3 1
3 9 6

here i want just one row corresponding to C1=1.

please giud me how should i proceed.



regards
khushbu
Jul 19 '10 #1
0 1297

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John | last post by:
Why does a select from table with an integer field return a row if I compare the integer to an alpha character? Here's the info ( a straight copy and paste), then compare my two select...
2
by: hubert.trzewik | last post by:
Hello, Is it possible to EXEC stored procedure from a query? I want to execute stored procedure for every line of SELECT result table. I guess it's possible with cursors, but maybe it's...
13
by: Botao | last post by:
Hi, Every Guru, I'd like to put a button on a page. When clicking the button, the table below it gets selected so the user can do Ctrl C to copy the entire table without using the mouse to...
9
by: saturnius | last post by:
Hello, I am passing a value to a stored procedure in vb.net to get normally a selection of the table. How could I get the complete table without writing the code twice? Many thanks in advance ....
3
by: Kall, Bruce A. | last post by:
I've look for a solution to this, but have only been able to find solutions to delete duplicate entries in a table by deleting entries not returned by SELECT DISTINCT. What sql should I use to...
6
by: Eugene F | last post by:
I am trying to figure out a single select statement from a table function f(x) when the function's argument is fed from another result set, like SELECT ... FROM TABLE( f(x) ) a where x is a...
2
by: pagoto123 | last post by:
select * from table where director = '" & Director.text & "' i want to display me all results that start with the director that the user will enter........ please i need the command help me...
4
by: d0m_at0m | last post by:
hello, how to select a table that has a highest amount of columns (compared to other tables) using syscat? thanks in advance
9
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all On SQL Server tables I use SqlDataReader to query data like "SELECT * FROM table". Is there something similar for XML Files ? I want to use SQL Syntax like "SELECT * FROM table" on a...
0
by: onyris | last post by:
Hi have this query which works ok now : SELECT * FROM WHERE (((Table.published) Like '*'&!!& '*' And (Table.published) Like '*'&!!& '*' and (Table.address) Like '*'&!!& '*' )); and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.