Dear all,
In SQL Server 2000 , how to get distinct records sort by one
field .
Example
SELECT DISTINCT A FROM tblTEST ORBER BY B
Here, In Table
Field 'A' contain more than one same data...
Field 'B' contain all are different Data......
I want distince in Field 'A' and order by Field 'B'..... how to get
it.........
regards
krishnan 2 3684
Hi
Posting DDL and sample data would help along with the output you require
from that data http://www.aspfaq.com/etiquette.asp?id=5006
If there are multiple B values for each A you will need some way of
distinguishing the one to use e.g.
SELECT A
FROM ( SELECT 1 AS A, 2 as B
UNION ALL SELECT 1, 3
UNION ALL SELECT 20, 3
UNION ALL SELECT 20, 4
UNION ALL SELECT 30, 1 ) AS Tbl
GROUP BY A
ORDER BY MIN(B)
John
"krishnan" <kr***************@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com... Dear all,
In SQL Server 2000 , how to get distinct records sort by one field .
Example
SELECT DISTINCT A FROM tblTEST ORBER BY B
Here, In Table
Field 'A' contain more than one same data... Field 'B' contain all are different Data......
I want distince in Field 'A' and order by Field 'B'..... how to get it.........
regards krishnan
krishnan wrote: Dear all,
In SQL Server 2000 , how to get distinct records sort by one field .
Example
SELECT DISTINCT A FROM tblTEST ORBER BY B
Here, In Table
Field 'A' contain more than one same data... Field 'B' contain all are different Data......
I want distince in Field 'A' and order by Field 'B'..... how to get it.........
regards krishnan
Please do not multi-post!
I have answered this in microsoft.public.sqlserver.programming
--
David Portas
SQL Server MVP
-- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: kristofera |
last post by:
I am trying to do a distinct grouping of some nodes sorted by a numeric
value but for some reason the distinct (preceding-sibling filter) is
applied to the result as if not sorted. If I don't use...
|
by: Johnson, Shaunn |
last post by:
Howdy:
Can someone tell what the difference (and why
you would use it) is between the following:
select distinct on (col_1, col_2),
col_1,
col_2,
col_3
|
by: Alex Satrapa |
last post by:
I have a table from which I'm trying to extract certain information. For
historical reasons, we archive every action on a particular thing
('thing' is identified, funnily enough, by 'id'). So the...
|
by: Kelvin |
last post by:
Okay so this is baking my noodle. I want to select all the
attritbutes/fields from a table but then to excluded any row in which
a single attributes data has been duplicated.
I.E. Here's my...
|
by: John M |
last post by:
Hi,
The line below is used to feed a combobox. (It is from a database which is
used to log pupil behaviour!) The 'incidents' table contains a list of
students who have been involved in incidents....
|
by: Fred Zuckerman |
last post by:
Can someone explain the difference between these 2 queries?
"Select Distinct id, account, lastname, firstname from table1"
and
"Select DistinctRow id, account, lastname, firstname from table1"
...
|
by: sdowney717 |
last post by:
from this, circdate being a datetime field:
SQLQuery = "select distinct circdate from circdata order by circdate"
I need the distinct date portion excluding the time part.
this has come about...
|
by: Bob Stearns |
last post by:
I am getting unwanted duplicate rows in my result set, so I added the
DISTINCT keyword to my outermost SELECT. My working query then returned
the following message:
DB2 SQL error: SQLCODE: -214,...
|
by: Techhead |
last post by:
I need to run a SELECT DISTINCT query across
multiple fields, but I need to add another field that is NON-DISTINCT
to my record set.
Here is my query:
SELECT DISTINCT lastname, firstname,...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |