Hello mysql,
MySQL 4.1.0-alpha-max-nt
phpMyAdmin 2.5.4
/* BEGIN DUMP */
CREATE TABLE `sp_tovar_vid` (
`id` int(11) NOT NULL auto_increment,
`id_tovar_vid` int(11) NOT NULL default '0',
`name` varchar(100) NOT NULL default '',
`description` varchar(255) NOT NULL default '',
UNIQUE KEY `id` (`id`)
) TYPE=InnoDB CHARSET=cp1251;
INSERT INTO `sp_tovar_vid` VALUES (1, 0, 'string 1', '');
INSERT INTO `sp_tovar_vid` VALUES (2, 1, 'string 2', '');
INSERT INTO `sp_tovar_vid` VALUES (3, 2, 'string 3', '');
INSERT INTO `sp_tovar_vid` VALUES (4, 0, 'string 4', '');
INSERT INTO `sp_tovar_vid` (`id`,`id_tovar_vid`,`name`,`description`) VALUES
('','0','','');
UPDATE `sp_tovar_vid` SET `id` = '0' WHERE `id` = LAST_INSERT_ID() LIMIT 1 ;
/* END DUMP */
/* BEGIN QUERY */
SELECT t1.`id`,
CONCAT(if(t3.`name`='','',CONCAT(t3.`name`,' ->
')),if(t2.`name`='','',CONCAT(t2.`name`,' -> ')),t1.`name`) AS col1,
t1.`description`
FROM `sp_tovar_vid` AS t1,
`sp_tovar_vid` AS t2,
`sp_tovar_vid` AS t3
WHERE t1.`id_tovar_vid`=t2.`id` AND
t2.`id_tovar_vid`=t3.`id` AND
col1>'string'
ORDER BY col1;
/* END QUERY */
QUESTION: why ERROR caused: #1054 - Unknown column 'col1' in 'where clause'
result wanted
+----+----------------------------------+-------------+
| id | col1 | description |
+----+----------------------------------+-------------+
| 1 | string 1 | |
| 2 | string 1 -> string 2 | |
| 3 | string 1 -> string 2 -> string 3 | |
| 4 | string 4 | |
+----+----------------------------------+-------------+
4 rows in set (0.00 sec)
/**/
--
Best regards,
Alex mailto:[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]