Access Query

M

Mike Harris

From the field listed below, I need to create a query that will return all
distinct values from B1 through B24. I have tried this using

SELECT Station_Operators.Station
FROM Station_Operators
WHERE Station LIKE 'B*';

but that query returns everything that begins with a B and also returns
mulitple instances of the same value. Any help as well as some tips on good
Access and Access programming books would be greatly appreciated.

Station_Operators Station
B1
B2
B3
B4
B5
B6
B7
B8
B9
B10
B11
B12
B13
B14
B15
B16
B17
B18
B19
B20
B21
B22
B23
B24
B1
B2
B3
B4
B5
B6
B7
B8
B9
B10
B11
B12
B13
B14
B15
B16
B17
B18
B19
B20
B21
B22
B23
B24
B1
B2
B3
B4
B5
B6
B7
B8
B9
B10
B11
B12
B13
B14
B15
B16
B17
B18
B19
B20
B21
B22
B23
B24
W1
W2
W3
W4
W5
W6
W7
W8
W9
W10
W11
W12
W13
W14
W15
W16
W17
W18
W19
W20
W21
W22
W23
W23
W25
W1
W2
W3
W4
W5
W6
W7
W8
W9
W10
W11
W12
W13
W14
W15
W16
W17
W18
W19
W20
W21
W22
W23
W24
W25
W1
W2
W3
W4
W5
W6
W7
W8
W9
W10
W11
W12
W13
W14
W15
W16
W17
W18
W19
W20
W21
W22
W23
W24
W25
BMW1
BMW2
BMW3
BMW4
BMW5
BMW6
BMW7
BMW8
BMW9
BMW10
BMW11
BMW12
BMW13
BMW14
BMW15
BMW16
BMW17
BMW18
BMW19
BMW20
BMW21
BMW22
BMW23
BMW24
BMW25
BMW1
BMW2
BMW3
BMW4
BMW5
BMW6
BMW7
BMW8
BMW9
BMW10
BMW11
BMW12
BMW13
BMW14
BMW15
BMW16
BMW17
BMW18
BMW19
BMW20
BMW21
BMW22
BMW23
BMW24
BMW25
BMW1
BMW2
BMW3
BMW4
BMW5
BMW6
BMW7
BMW8
BMW9
BMW10
BMW11
BMW12
BMW13
BMW14
BMW15
BMW16
BMW17
BMW18
BMW19
BMW20
BMW21
BMW22
BMW23
BMW24
BMW25
AT1L
AT1R
AT1L
AT1R
AT1L
AT1R
 
M

Michel Walsh

Hi,


SELECT DISTINCT ...


should do the trick. You can also use a GROUP BY query, listing, as group,
any selected fields.


Hoping it may help,
Vanderghast, Access MVP
 
G

Guest

Michel's suggestion covers the first part of your problem - how to eliminate duplicates, but not how to eliminate values such as BMWxxx. Since I can't get to any SQL-realted syntax help right now (see my post in this same newsgroup) - I'm going to have to guess. Most SQL processors support Unix-style regular expressions. If Microsoft does, you should be able to use something like
WHERE station LIKE "B[1-24]

Check the help to see if regular expressions are support. If they are, the syntax will be close to what I've listed. Hope this helps.
 
Y

Yuan Shao

Hi Mike,

How is the issue going on your side? Let us know if you need further
assistance on this issue.

Regards,

Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Access Query question 1

Top