relative table fields

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
cybaf
Forum Commoner
Posts: 89
Joined: Tue Oct 01, 2002 5:28 am
Location: Gothenburg Sweden

relative table fields

Post by cybaf »

is it possible (in mysql) to create a table with a field which is relative to other fields in the same table?

eg:

Code: Select all

create table testing (a int, b int, a+b as c)
this would make my life much easier...:)
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

No. The closest thing I can think of is Views, but thats not supported in MySQL (yet, it's in devel i think).

But you can manage to do that directly in a select clause using CONCAT(), or similiar:

Code: Select all

mysql> SELECT CONCAT('PHP', 'D', 'N');
                        -> 'PHPDN'
User avatar
cybaf
Forum Commoner
Posts: 89
Joined: Tue Oct 01, 2002 5:28 am
Location: Gothenburg Sweden

Post by cybaf »

ok that's too bad... thanks anyways...
Post Reply