I´ve searched a lot but I can´t figure out how to do it, if it´s possible...
I have this table:
CREATE TABLE bilanci (
id int AUTO_INCREMENT NOT NULL,
medicoid int NOT NULL,
`1` int NOT NULL DEFAULT 0,
`2` int NOT NULL DEFAULT 0,
`3` int NOT NULL DEFAULT 0,
`4` int NOT NULL DEFAULT 0,
`5` int NOT NULL DEFAULT 0,
`6` int NOT NULL DEFAULT 0,
`7` int NOT NULL DEFAULT 0,
`8` int NOT NULL DEFAULT 0,
`9` int NOT NULL DEFAULT 0,
`10` int NOT NULL DEFAULT 0,
`11` int NOT NULL DEFAULT 0,
`12` int NOT NULL DEFAULT 0,
conguagliodic decimal(10,2),
totbilancianno int DEFAULT 0,
totpagato decimal(12,2),
totdapagare decimal(12,2),
conguaglio decimal(10,2),
rifanno int NOT NULL,
pvimun decimal(10,4) NOT NULL DEFAULT 9.4432,
PRIMARY KEY (id)
) ENGINE = InnoDB;
The fileds named with numbers correspond to months and I need to have a select like:
select medicoid, (month(curdate()) -2), totdapagare from bilanci
Where (month(curdate()) -2)
correspond to the field I need to select.
Is this possible?