i want to make a query which generates in a field values helpppppppppppppp

  • Thread starter Thread starter asyyyya via AccessMonster.com
  • Start date Start date
A

asyyyya via AccessMonster.com

i have a table with fields:cod, name, number_envelope. I want to make a query
which generates in a field
"cod" value of "number_envelope" times (eq. first value from "cod" is 1 and
"number_envelop" is 10 i want to generate in the field 10 values of 1,if the
"cod " value is 2 and "number_envelope" is 17 i want to generate in the same
field after those 10 values of 1, 17 values of 2,and so on)
i'd like to do these in sql.
 
i have a table with fields:cod, name, number_envelope. I want to make a query
which generates in a field
"cod" value of "number_envelope" times (eq. first value from "cod" is 1 and
"number_envelop" is 10 i want to generate in the field 10 values of 1,if the
"cod " value is 2 and "number_envelope" is 17 i want to generate in the same
field after those 10 values of 1, 17 values of 2,and so on)
i'd like to do these in sql.

You can do so by using an auxiliary table. Create a table named NUM
with one field N; fill it with values from 1 to the largest number of
envelopes you'll ever need (be generous!)

Use a "non equi join" query:

SELECT cod, [name], N
FROM yourtable INNER JOIN Num
ON Num.N <= yourtable.[number_envelope];

This has the advantage that you can use "record N of
[number_envelope]" if needed, e.g. record 3 of 17.

John W. Vinson[MVP]
 
John said:
i have a table with fields:cod, name, number_envelope. I want to make a query
which generates in a field
[quoted text clipped - 3 lines]
field after those 10 values of 1, 17 values of 2,and so on)
i'd like to do these in sql.

You can do so by using an auxiliary table. Create a table named NUM
with one field N; fill it with values from 1 to the largest number of
envelopes you'll ever need (be generous!)

Use a "non equi join" query:

SELECT cod, [name], N
FROM yourtable INNER JOIN Num
ON Num.N <= yourtable.[number_envelope];

This has the advantage that you can use "record N of
[number_envelope]" if needed, e.g. record 3 of 17.

John W. Vinson[MVP]

help
syntax error (missing operator) in quary expression 'Num.N <= yourtable.
[number_envelope]'
please give me another solution or an explanation for what's happen
 
It helps if you post what is failing. The assumption is that you changed
the SQL to match your table and field names. I would guess that you have
entered something incorrectly.

Please copy and post the SQL of your query so that John (and others) can
see what you have entered.

(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message


asyyyya via AccessMonster.com said:
John said:
i have a table with fields:cod, name, number_envelope. I want to make a
query
which generates in a field
[quoted text clipped - 3 lines]
field after those 10 values of 1, 17 values of 2,and so on)
i'd like to do these in sql.

You can do so by using an auxiliary table. Create a table named NUM
with one field N; fill it with values from 1 to the largest number of
envelopes you'll ever need (be generous!)

Use a "non equi join" query:

SELECT cod, [name], N
FROM yourtable INNER JOIN Num
ON Num.N <= yourtable.[number_envelope];

This has the advantage that you can use "record N of
[number_envelope]" if needed, e.g. record 3 of 17.

John W. Vinson[MVP]

help
syntax error (missing operator) in quary expression 'Num.N <= yourtable.
[number_envelope]'
please give me another solution or an explanation for what's happen
 

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

Back
Top