Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I define a query's column value? 1

Status
Not open for further replies.

joelwenzel

Programmer
Jun 28, 2002
448
I want to set a value in a query. Here I want to create a colum MyType in the query and set it either 1 or 2. This doesn't work however.

SELECT
Avg(Col1), 1 as MyType
FROM Table1

UNION ALL

SELECT
Avg(Col2), 2 as MyType
FROM Table1
 
That should work... is there any runtime error or what?

------
[small]select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')[/small]
[banghead]
 
I just tried your query on my database. Obviously, I changed the table and the fields, but it works.

Exactly what about this query is not working? Are you getting an error message?

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Ok,
i think I had some other random error before. I had never tried this so I thought there was something wrong with the way I was doing it...but I guess not.

thanks a lot for your help You have really helped me move on this project.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top