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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT * (except image_data) from ...

Status
Not open for further replies.

LittleHavoc

IS-IT--Management
Nov 28, 2001
56
GB
I want to build a query that pulls back all the fields within the table , EXCEPT a particular one that will cause problems in speed and memory.

I don't want to generate a long list of field names just omit one from all of them.

ALL DATA - BUT GETS BINARY DATA OF LARGE IMAGES
Select * from images

ALL RELEVANT DATA - BUT TOO LONG
Select id, image_size, image_width ........... from images

oh! I think I will add an extra field, now I have to change all my queries.

want something like :-
select * -image_data from images

I can now add/remove fields and I only need to amend areas that use them.
 
If you add a column to a table its likely you want to do something with the value. If you have queries in say 20 different places in your system accessing one table:

select id, name, adress from personal...
select id, birthday from personal...
...

Now if you want to add a column you probably dont need this value in all 20 places.

Another way to deal with this is having interface, like an class in java.

public class Personal {
...
public getID() {
...
}
...
}

Now you add a column in the table in one place and use the new column where it is needed in the rest of the code.
 
Sorry, but I was enquiring about constructing a static MySQL query.

I am only using the query a few times, but wanted to make it as easy to read as possible and capable of handling adding and removing fields at a later stage without generating errors.

As a work around, I was finding it impossible to do a dump of this table in phpMyAdmin, and so I removed the binary datafield to another table just containing id copied from original table and binary_data. This removed the need to omit it from the query, and just include it where needed.

Thanx anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top