A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to make multiple values show up



 
 
Thread Tools Display Modes
  #1  
Old March 1st, 2010, 05:19 AM posted to microsoft.public.access.queries
Clddleopard
external usenet poster
 
Posts: 59
Default How to make multiple values show up

I have a table that has the fields SpeciesID and Frequency (both Long
Integer). Example Data:
SpeciesID Frequency
1 3
2 1
3 4

I would like somehow to see the resulting data:
SpeciesID
1
1
1
2
3
3
3
3

In other words, have SpeciesID represented in the data set as many times as
it has frequency in the original table.

Any ideas?
  #2  
Old March 1st, 2010, 05:28 AM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default How to make multiple values show up

On Sun, 28 Feb 2010 21:19:01 -0800, Clddleopard
wrote:

I have a table that has the fields SpeciesID and Frequency (both Long
Integer). Example Data:
SpeciesID Frequency
1 3
2 1
3 4

I would like somehow to see the resulting data:
SpeciesID
1
1
1
2
3
3
3
3

In other words, have SpeciesID represented in the data set as many times as
it has frequency in the original table.

Any ideas?


You can do this with the help of a little auxiliary table. I'll usually add a
table named Num, with one Long Integer field N, filled with values from 0
through 10000 or so (use Excel... Insert... Series and copy and paste is a
quick way to fill it).

A query

SELECT SpeciesID
FROM yourtable INNER JOIN Num
ON Num.N yourtable.Frequency

will give you the result you describe.
--

John W. Vinson [MVP]
  #3  
Old March 1st, 2010, 02:14 PM posted to microsoft.public.access.queries
Clddleopard
external usenet poster
 
Posts: 59
Default How to make multiple values show up

Thanks John, that worked great, though I did end up having to write it as
SELECT SpeciesID
FROM yourtable INNER JOIN Num
ON Num.N =yourtable.Frequency
to get the correct result.
Thanks again!
"John W. Vinson" wrote:

On Sun, 28 Feb 2010 21:19:01 -0800, Clddleopard
wrote:

I have a table that has the fields SpeciesID and Frequency (both Long
Integer). Example Data:
SpeciesID Frequency
1 3
2 1
3 4

I would like somehow to see the resulting data:
SpeciesID
1
1
1
2
3
3
3
3

In other words, have SpeciesID represented in the data set as many times as
it has frequency in the original table.

Any ideas?


You can do this with the help of a little auxiliary table. I'll usually add a
table named Num, with one Long Integer field N, filled with values from 0
through 10000 or so (use Excel... Insert... Series and copy and paste is a
quick way to fill it).

A query

SELECT SpeciesID
FROM yourtable INNER JOIN Num
ON Num.N yourtable.Frequency

will give you the result you describe.
--

John W. Vinson [MVP]
.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.