473,386 Members | 1,803 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,386 software developers and data experts.

Unique items

Hiya

I have a datatable with some columns. I would like to be able to retrieve a
list of the items in a column but only once e.g. if the column held
A,A,B,C,D,E,D then I'd like to be able to retrieve A,B,C,D,E.

Can anybody suggest how this can be done?

Thanks in advance

Geoff
Nov 21 '05 #1
4 1140
You mean with a SQL statement? 'Distinct' keyword after SELECT.

SELECT DISTINCT "column_name"
FROM "table_name"
"Geoff Jones" <no********@email.com> schreef in bericht
news:41*********************@news.dial.pipex.com.. .
Hiya

I have a datatable with some columns. I would like to be able to retrieve
a list of the items in a column but only once e.g. if the column held
A,A,B,C,D,E,D then I'd like to be able to retrieve A,B,C,D,E.

Can anybody suggest how this can be done?

Thanks in advance

Geoff

Nov 21 '05 #2
"Geoff Jones" <no********@email.com> wrote in message
news:41*********************@news.dial.pipex.com.. .
I have a datatable with some columns. I would like to be able to
retrieve a list of the items in a column but only once e.g. if the
column held A,A,B,C,D,E,D then I'd like to be able to retrieve

A,B,C,D,E.

OK; got a little confused by the "sideways" representation of columns
for a second, there, but I think what you're looking for is the "distinct"
keyword, as in

select distinct ColumnName
from TableName
where Thingy = Whatsit
or Whatever

Simply enough if you only want a /single/ column; things get a little
hairier if you're retrieving /more/ than one.

HTH,
Phill W.
Nov 21 '05 #3
Hi,
Use SELECT Distinct ColumnName FROM Table
Hope this will help u........

Regards,
Ritesh

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #4
Many thanks everyone

Geoff

"Ritesh Jain via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in
message news:e3******************************@DotNetMonste r.com...
Hi,
Use SELECT Distinct ColumnName FROM Table
Hope this will help u........

Regards,
Ritesh

--
Message posted via http://www.dotnetmonster.com

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: kevin parks | last post by:
hi. I've been banging my head against this one a while and have asked around, and i am throwing this one out there in the hopes that some one can shed some light on what has turned out to be a...
22
by: Claudio Jolowicz | last post by:
Is it possible to store unique objects in an STL container? Suppose an object of class C is unique: class C { public: C() {} ~C() {} private:
2
by: typingcat | last post by:
Hello. I'd like to know the SQL query for the following operation. Table AUTHOR BOOK Bill A Bill B Charles A Bill C ....
3
by: Joanna Epstein | last post by:
I have several tables formatted as follows: ITEM #, ITEM DESCRIPTION, PL, JANUARY ITEM #, ITEM DESCRIPTION, PL, FEBRUARY And so on… I need to create a final report that merges all of the...
2
by: Martin | last post by:
Hi, Please can somebody explain how databinding is done on a checkbox list. I have the follwoing code which I would have thought was enough to databind a checkbox, but apparently not. The...
6
by: nasirmajor | last post by:
dear all, i have a datagrid with checkboxes for selection of rows. and want to get unique id/ids(job_code) from the selected rows in array etc. can anyone help. <asp:datagrid id="dgResults"...
11
by: garyhoran | last post by:
Hi Guys, I have a collection that contains various attributes (stuff like strings, DateTime and Timespan) . I would like to access the collection in various orders at different points in the...
3
by: mark4asp | last post by:
Stack of limited size containing unique items? Hi guys, How would I implement a stack of limited size containing unique items? For example. Suppose my stack has . I add 2 to it and it is now...
4
by: jameswilkinsonfjs | last post by:
Hi All, Ok I have a table - it lists items with a unique reference code; lets say there are 4 items : Item RefCode 1 ABC1 2 ABC2 3 ...
6
by: akadeco | last post by:
Hi I need to write a program and part it's functionality is to delete unique items in an array. That is, delete items in the array that only occur once. I also need to delete the first...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.