views:

228

answers:

6

I have a table in ms-access with column names A to H

TableA 

A   B  C  D  E  F G  H

how can i write a query to select all columns except B and F columns. Query result should be

A C D E G H

Do we have something like this

select * from TableA except B, F ?
+2  A: 

Nope, you're stuck with

select a, c, d, e, g, h from TableA
David Hedlund
+1  A: 
select A, C, D, E, G, H from TableA
klausbyskov
A: 

You can't do this. It is '*' or just the fields you specify. Is this a big problem? Or is it just that you want something "neater"?

Mark Bertenshaw
+3  A: 

No, we don't. You have to use

SELECT A, C, D, E, G, H 
FROM TableA

And this is good if you ask me. SELECT * is evil enough.

Maximilian Mayerl
+1 for the "SELECT * is evil".
David-W-Fenton
+1  A: 

I don't know for sure, but it's definitely better to explicitly specify the columns you want to select. This makes any potential changes to your table easier to live with as you can use aliases etc.

mdresser
+1  A: 

select A, C, D, E, G, H from TableA or create a view and select from that as below CREATE VIEW vTableA as
select A, C, D, E, G, H from TableA

valli