Adding Fix row to query result

C

carlo

Hi all

I would like to do following:

I have a query which returns rows out of a table, nothing fancy, just
a normal select statement.
i now would like to add a row at the beginning which would always be
fix (for example a "*")

my query result:
1111
2222
3333
4444

what i want:
*
1111
2222
3333
4444

I was wondering if that is possible or not, otherwise i would do it
with VBA.

Thanks for any Input.

Carlo
 
G

Gary Walter

carlo said:
I would like to do following:

I have a query which returns rows out of a table, nothing fancy, just
a normal select statement.
i now would like to add a row at the beginning which would always be
fix (for example a "*")

my query result:
1111
2222
3333
4444

what i want:
*
1111
2222
3333
4444
Hi Carlo,

You can use UNION query but remember
column types have to be the same field types

and

"beginning" in Access means by sorting
(and is not the same as Excel).

for example, "tbl" with number field "Num"

Num
1111
2222
3333
4444

then UNION query (which you have to
write out in SQL Design) might look like...


SELECT
"*" As AlphaNum,
0 As SortNum
FROM
tbl
UNION ALL
SELECT
CStr(Num),
Num
FROM
tbl
ORDER BY SortNum;

would give

AlphaNum SortNum
* 0
1111 1111
2222 2222
3333 3333

good luck,

gary
 
C

carlo

Hi Carlo,

You can use UNION query but remember
column types have to be the same field types

and

"beginning" in Access means by sorting
(and is not the same as Excel).

for example, "tbl" with number field "Num"

Num
1111
2222
3333
4444

then UNION query (which you have to
write out in SQL Design) might look like...

SELECT
"*" As AlphaNum,
0 As SortNum
FROM
tbl
UNION ALL
SELECT
CStr(Num),
Num
FROM
tbl
ORDER BY SortNum;

would give

AlphaNum   SortNum
*                    0
1111              1111
2222              2222
3333              3333

good luck,

gary- Hide quoted text -

- Show quoted text -

Thanks gary

helps me a lot.

Carlo
 

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

Top