General discussion

Locked

Filter single column in a recordset

By icekoool ·
I created a recordset in Visual Basic 6.0 consisting of 2 columns. How to clone this recordset so that the cloned recordset consists of a single column only having distinct record(s)?

eg: Original Recordset has 2 columns(fields) as:

Item WareHouseCode
---- -------------
CMT WHS1
CMT WHS2
PKG WHS1
PKG WHS2

The resultant recordset should give me only one colummn with distinct values. As in this case
Cloned Recordset:

Item
----
CMT
PKG

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Filter single column in a recordset

by Glen_McLeod In reply to Filter single column in a ...

Why are you doing this on the client? This is something that you should let the server do. If you've executed an SQL statement to get the original recordset like this:

'Select Item, WhareHouseCode From yourTable'

then simply execute anotherto get your second desired recordset:

'Select Distinct Item From yourTable'

Recordsets do not have an easy way of doing what you want here, you'd have to code a nested loop structure manually. Which would be a big waste of time when the database can give it to you with 1 statement.

Glen

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums