Adding Fix row to query result

  • Thread starter Thread starter carlo
  • Start date Start date
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
 
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
 
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
 
Back
Top