[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Импорт запроса в MySQL
pantela
Всем привет. Вопрос к MySQL, почему когда я пытаюсь сделать импорт таблицы с типом View

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_base` AS select `b`.`id` AS `id`,`u`.`name` AS `author`,`b`.`buyer_id` AS `buyer_id`,`b`.`author` AS `author_id`,`b`.`user_comment` AS `user_comment`,(select if(((select count(0) AS `COUNT(*)` from `photos` where (`photos`.`base_id` = `b`.`id`)) = 0),0,1) AS `IF((SELECT COUNT(*) FROM ``photos`` WHERE ``base_id`` = b.id) = 0, FALSE,TRUE)`) AS `photo`,`m`.`name` AS `manufacturer`,`b`.`manufacturer` AS `manufacturer_id`,`mod`.`name` AS `model`,`b`.`model` AS `model_id`,`b`.`year` AS `year`,`b`.`ibs` AS `ibs`,`b`.`parts` AS `parts`,`b`.`vin` AS `vin`,`b`.`branch` AS `branch`,`b`.`name_surname` AS `name_surname`,`b`.`passport_number` AS `passport_number`,`b`.`telephone` AS `telephone`,`b`.`date` AS `date`,`b`.`auction_pay` AS `auction_pay`,`b`.`ch_1` AS `ch_1`,`b`.`tax` AS `tax`,`b`.`title` AS `title`,`b`.`dakresiti` AS `dakresiti`,`b`.`unknown_field` AS `unknown_field`,`b`.`key` AS `key`,`b`.`stock_lot` AS `stock_lot`,`b`.`auth` AS `auth`,`st`.`title` AS `state`,`b`.`state` AS `state_id`,`b`.`zip_number` AS `zip_number`,`b`.`auction_address` AS `auction_address`,`b`.`auction_telephone` AS `auction_telephone`,`at`.`title` AS `auction_title`,`b`.`auction_title` AS `auction_title_id`,`pod`.`title` AS `point_of_delivery`,`b`.`point_of_delivery` AS `point_of_delivery_id`,`b`.`hidden_information` AS `hidden_information`,`b`.`inside_transport_usa` AS `inside_transport_usa`,`b`.`container_amount` AS `container_amount`,`b`.`diler` AS `diler`,`b`.`services` AS `services`,`b`.`transfer_charges` AS `transfer_charges`,`b`.`other_service` AS `other_service`,`b`.`consultation` AS `consultation`,(((((((`b`.`auction_pay` + `b`.`inside_transport_usa`) + `b`.`container_amount`) + `b`.`diler`) + `b`.`services`) + `b`.`transfer_charges`) + `b`.`other_service`) + `b`.`consultation`) AS `f1`,(select sum(`diler_desc`.`price`) AS `SUM(price)` from `diler_desc` where (`diler_desc`.`base_id` = `b`.`id`)) AS `diler_desc`,`b`.`pm_1` AS `pm_1`,`b`.`client_payer_1` AS `client_payer_1`,`b`.`payment_date_1` AS `payment_date_1`,`b`.`transfer_fee_1` AS `transfer_fee_1`,`b`.`percent_votes` AS `percent_votes`,if((`b`.`pm_1` < `b`.`auction_pay`),((((((((((`b`.`auction_pay` + `b`.`inside_transport_usa`) + `b`.`container_amount`) + `b`.`diler`) + `b`.`services`) + `b`.`transfer_charges`) + `b`.`other_service`) + `b`.`consultation`) - `b`.`pm_1`) / 100) * `b`.`percent_votes`),0) AS `f5`,`b`.`pm_2` AS `pm_2`,`b`.`client_payer_2` AS `client_payer_2`,`b`.`payment_date_2` AS `payment_date_2`,`b`.`pm_3` AS `pm_3`,`b`.`client_payer_3` AS `client_payer_3`,`b`.`payment_date_3` AS `payment_date_3`,((((((((((((`b`.`auction_pay` + `b`.`inside_transport_usa`) + `b`.`container_amount`) + `b`.`diler`) + `b`.`services`) + `b`.`transfer_charges`) + `b`.`other_service`) + `b`.`consultation`) + if((`b`.`pm_1` < `b`.`auction_pay`),((((((((((`b`.`auction_pay` + `b`.`inside_transport_usa`) + `b`.`container_amount`) + `b`.`diler`) + `b`.`services`) + `b`.`transfer_charges`) + `b`.`other_service`) + `b`.`consultation`) - `b`.`pm_1`) / 100) * `b`.`percent_votes`),0)) - `b`.`pm_1`) - `b`.`pm_2`) - `b`.`pm_3`) + `b`.`transfer_fee_1`) AS `f2`,`b`.`pre_payments` AS `pre_payments`,`b`.`date_1` AS `date_1`,(`b`.`auction_pay` - `b`.`pre_payments`) AS `f3`,(((((((((((((`b`.`auction_pay` + `b`.`inside_transport_usa`) + `b`.`container_amount`) + `b`.`diler`) + `b`.`services`) + `b`.`transfer_charges`) + `b`.`other_service`) + `b`.`consultation`) + if((`b`.`pm_1` < `b`.`auction_pay`),((((((((((`b`.`auction_pay` + `b`.`inside_transport_usa`) + `b`.`container_amount`) + `b`.`diler`) + `b`.`services`) + `b`.`transfer_charges`) + `b`.`other_service`) + `b`.`consultation`) - `b`.`pm_1`) / 100) * `b`.`percent_votes`),0)) - `b`.`pm_1`) - `b`.`pm_2`) - `b`.`pm_3`) + `b`.`transfer_fee_1`) - `b`.`pre_payments`) AS `f4`,`b`.`transfer_money_2_stage` AS `transfer_money_2_stage`,`b`.`transfer_date_2_stage` AS `transfer_date_2_stage`,`b`.`auction_final_amount_transferred` AS `auction_final_amount_transferred`,(((((((((`b`.`auction_pay` + `b`.`inside_transport_usa`) + `b`.`container_amount`) + `b`.`diler`) + `b`.`transfer_charges`) + `b`.`other_service`) + `b`.`consultation`) + `b`.`pre_payments`) - `b`.`transfer_money_2_stage`) - `b`.`auction_final_amount_transferred`) AS `f7`,(`b`.`services` + `b`.`percent_votes`) AS `f8`,((`b`.`pre_payments` + `b`.`transfer_money_2_stage`) + `b`.`auction_final_amount_transferred`) AS `f9`,`b`.`parts_document` AS `parts_document`,`wc`.`title` AS `where_comes`,`b`.`where_comes` AS `where_comes_id`,`b`.`container_number` AS `container_number`,`cl`.`title` AS `container_location`,`b`.`container_location` AS `container_location_id`,`cln`.`title` AS `container_line`,`b`.`container_line` AS `container_line_id`,`b`.`terminal_out_date` AS `terminal_out_date`,`b`.`requesting` AS `requesting`,`b`.`refunded` AS `refunded`,`b`.`date_open_container` AS `date_open_container`,`b`.`excess` AS `excess`,`b`.`share_item` AS `share_item`,`b`.`in_archive` AS `in_archive`,`b`.`is_del` AS `is_del` from (((((((((`base` `b` left join `manufacturer` `m` on((`m`.`id` = `b`.`manufacturer`))) left join `model` `mod` on((`mod`.`id` = `b`.`model`))) left join `state` `st` on((`st`.`id` = `b`.`state`))) left join `auction_title` `at` on((`at`.`id` = `b`.`auction_title`))) left join `point_of_delivery` `pod` on((`pod`.`id` = `b`.`point_of_delivery`))) left join `where_comes` `wc` on((`wc`.`id` = `b`.`where_comes`))) left join `users` `u` on((`b`.`author` = `u`.`uid`))) left join `container_location` `cl` on((`cl`.`id` = `b`.`container_location`))) left join `container_line` `cln` on((`cln`.`id` = `b`.`container_line`)));


у меня появляется жёлтая ошибка: #1166 - Incorrect column name 'IF((SELECT COUNT(*) FROM `photos` WHERE `base_id` = b.id) = 0, FALSE,TRUE)'


P.S. Пока я начал бы делать этот запрос до того я добавил в некоторые таблицы поле "refunded"

_____________
Как сшить рюкзак
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.