gpt4 book ai didi

mysql - excel mysql不读取所有select语句

转载 作者:行者123 更新时间:2023-11-30 22:21:15 26 4
gpt4 key购买 nike

我创建了一个 ODBC 连接以直接从 Excel 文件查询 MySQL 数据库。这是一个相当复杂的查询,包含大约 60 个选择语句,在原始 MySQL 数据库和从 Microsoft Query 连接时都能完美运行。但是,当我在 Excel 工作表上发布结果时,它会显示除两列之外的所有列(都有 ## <-- THIS !!! 评论)

select
nom_client as Custname
,case when locate('/',nom_voyageur) > 0
then substring(nom_voyageur,1,locate('/',nom_voyageur)-1)
else nom_voyageur end as Lastname
,case when locate('/',nom_voyageur) > 0
then substring(nom_voyageur,locate('/',nom_voyageur) + 1, length(nom_voyageur)-locate('/',nom_voyageur))
else '' end as Firstname
,zone_stat_1 as Empcode
,concat(substring(booker,locate(' ',booker) + 1, length(booker)-locate(' ',booker)),' ',substring(booker,1,locate(' ',booker)-1)) as Booker
,zone_stat_3 as 'Euronext TAF Approver level 2'
,'' as "Trip Reason"
,prestation_name as Vendor
,departure_date as Servicedate
,'' as Savings
,advance_purchase as Advpurchgroup
, tickets_number as Ticketcount
, '' as Triplength
,'' as 'Class of Service'
,case Activite when 1 then 'Rail'
when 2 then 'Hotel'
when 3 then 'Maritime'
when 4 then 'Fees / Regulations'
when 5 then 'Air'
when 6 then 'Frais'
when 7 then 'Visa / Shipments / Subscriptions / ESTA' end as Producttype
,case when length(trajet_origine_destination) > length(replace(trajet_origine_destination,'/',''))
then substring(trajet_origine_destination,1,locate('/',trajet_origine_destination)-1)
else trajet_origine_destination end as 'Origin Cityname'
,case when length(trajet_origine_destination) > length(replace(trajet_origine_destination,'/',''))
then substring(trajet_origine_destination,locate('/',trajet_origine_destination) + 1, length(trajet_origine_destination)-locate('/',trajet_origine_destination))
else trajet_origine_destination end as 'Destination Cityname'
,'Invoice' as Fop
,'APInv' as 'Journal Name'
,Invoice_date as 'Invoice Date'
,'Vendor' as 'Account Type'
,'' as LCOA
,640139 as 'Main Account'
,Zone_stat_2 as 'Cost Center'
,'' as Project
,'' as MarketSegment
,'' as Custumer
,'FAES000528' as Supplier
,'' as Intercompany
,'' as Product
,'' as Dim9
,'' as Dim10
,'Ledger' as OffAccountType
,'' as OffMainAccount
,'' as OffsetLCOA
,'' as OffCostCenter
,'' as OffProject
,'' as OffMarketSegment
,'' as OffCustomer
,'' as OffSupplier
,'' as OffIntercompany
,'' as OffProduct
,'' as OffDim9
,'' as OffDim10
,concat('FCM-Invoice ',numero_facture,' - ',prestation_name,' - ',substring(nom_voyageur,1,locate('/',nom_voyageur)-1),' ',substring(nom_voyageur,locate('/',nom_voyageur) + 1, length(nom_voyageur)-locate('/',nom_voyageur))) as Description ## <-- THIS!!!
,'EUR' as CurrencyCode
,case when Montant_vente > 0 then Montant_vente else 0 end as AmountCurDebit
,case when Montant_vente < 0 then Montant_vente*-1 else 0 end as AmountCurCredit
,case when Montant_vente > 0 then Montant_vente else 0 end as FunctionalCUrDebit
,case when Montant_vente < 0 then Montant_vente*-1 else 0 end as FunctionalCurCredit
,'AP Posting' as PostingProfile
,'Electronic' as PaymMode
,'INMEDIATE' as Payment
,concat(year(now()),'-',if(month(now())<10,concat('0',month(now())),month(now())),'-13') as Due ## <-- THIS!!!
,'AP_DOM' as 'TaxGroup'
,case activite when 6 then 'HIGH_S' else 'EXEMPT' end as TaxItemGroup
,'' as DocumentNum
,Invoice_date as DocumentDate
,numero_facture as Invoice
,'' as Prepayment
,'' TaxCode
,'' ExchRate
,'No' as ReverseEntry
,'' as ReverseDate
,'FAES' as Company
,'FAES' as OffsetCompany
from extrait_sapeig_stat e
where mot_dir_client = 'ETT'
and invoice_year = year(date_add(now(),Interval -1 month)) and invoice_month = month(date_add(now(),Interval -1 month))
and activite != 11
order by invoice_date, numero_facture;

为了简化起见,这些是故障陈述

',substring(nom_voyageur,locate('/',nom_voyageur) + 1, length(nom_voyageur)-locate('/',nom_voyageur))) as Description  ## <-- THIS!!!
,concat(year(now()),'-',if(month(now())<10,concat('0',month(now())),month(now())),'-13') as Due ## <-- THIS!!!

我不知道他们失败的原因。我在同一个查询中已经有了更长的语句,并且函数 concat() 也已经可以工作了。我假设具有 3 个以上缩进函数的语句存在问题,但我不确定。

如果你们中有人知道为什么会失败,那将对我有很大帮助

Microsoft Query 中的正确结果

Microsoft Query

描述列在 Excel 工作表中消失

Excel Sheet

最佳答案

为什么不将其转换为 MS Access,然后再将 MS Access 转换为 MySQL

关于mysql - excel mysql不读取所有select语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36568466/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com