Hi, I'm just a user and I had this query programmed by a friend and seems to have stop working.
The error message I get says that the error is near the CASE WHEN statement at line 8. Any comments are welcomed and if possible suggestions to correct the error. - Select vendor,F.airline_code,F.invoice_nmr invoice_vendor,F.booking_nmr,
-
sum(amount) total_factura , IF(tipo = 'CH',facturado,pagado) monto_pagado,tipo,
-
concat(b_month,'-',b_year) periodo_factura,F.fecha_carga,date awb_date,count(*) Reg
-
from p24l3dbd_costos.PAGOS G
-
RIGHT JOIN p24l3dbd_costos.FACTURAS F ON F.booking_nmr = G.booking_nmr and F.airline_code = G.airline_code
-
LEFT JOIN p24l3dbd_costos.GUIAS_ID I ON F.booking_nmr = I.booking_nmr and F.airline_code = I.id_ch
-
group by F.airline_code,F.invoice_nmr,F.booking_nmr,F.fecha_carga
-
order by F.select *, CASE
-
WHEN vendor is null THEN 'Sin Guia' ELSE 'Con Guia' END estado_factura,
-
CASE WHEN dif <=-5 or vendor is null THEN 'A Disputar' ELSE 'A Pagar' END pagar
-
from (Select vendor ,airline_code ,invoice_nmr invoice_vendor,F.booking_nmr,date awb_date,F.ori,F.dest ,accrual_cost provision
-
,pagado total_pagado,facturado total_facturado,
-
IF(G.tipo='CH',(accrual_cost-pagado),(accrual_cost-pagado-sum(amount))) dif,
-
sum(amount) ultima_factura ,nmr_pago ,weight vendor_chw,booking_chw awb_chw,spotref,
-
concat(substring(billing_per_begin,1,2),'-',substring(billing_per_begin,9,2)) periodo_guia,
-
concat(b_month,'-',b_year) periodo_factura,tipo,fecha_carga
-
from p24l3dbd_costos.GUIAS_ID G
-
RIGHT JOIN p24l3dbd_costos.FACTURAS F
-
ON F.booking_nmr = G.booking_nmr and F.airline_code = G.id_ch
-
group by F.airline_code,F.invoice_nmr,F.booking_nmr,fecha_carga) x
-
order by vendor, (str_to_date(fecha_carga,'%m/%d/%Y')) DESC, vendor desc
1 1134 Rabbit 12,516
Recognized Expert Moderator MVP
Please use code tags when posting code or formatted data.
You're saying this used to run? That can't be, it looks like you have 2 different queries running into each other on line 8.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Morten Gulbrandsen |
last post by:
C:\mysql\bin>mysql -u elmasri -pnavathe company
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 29 to server version: 4.1.0-alpha-max-debug
Type...
|
by: Tim Reynolds |
last post by:
I support a .Net application running on a SERVER accessing MF Db2
data. Occasionally, we have some type of connection problem that we
have been unable to debug up to this point. We typically...
|
by: amitpatel66 |
last post by:
Hi,
Is PLSQL Anonymous block allowed in CASE WHEN statement when CASE is used in SELECT statement.
Check below code which executes but does not return anything:
SELECT job, CASE WHEN job =...
|
by: laurenquantrell |
last post by:
Is there an equivalant construction to the CASE WHEN statement that
can be used in the WHERE clause?
For example, this works:
SELECT
FirstName = CASE WHEN c.FirstName = 'Bob' THEN
'Robert'...
|
by: dipperdan |
last post by:
Hi,
I'm getting an error 1064 when trying to delete some rows from a table.
SQL is:
DELETE FROM images WHERE image_id = 803 AND plant_num = 2277 LIMIT 1;
DELETE FROM images WHERE image_id =...
| |
by: Anthony97 |
last post by:
Has anyone worked with multiple case when comments? I converted a query from access 07 to SQL Server 2005. Initially the query was using IIf instead of CASE WHEN. Any help or examples is greatly...
|
by: phobia1 |
last post by:
Hi once again.
We have just changed our ISP and things that worked fine now do not, Obviously its in the differences of MYSQL and PHP versions.
Have fixed most of the problems but this UPDATE...
|
by: Charles Ndethi |
last post by:
Hi I want to set the session id to a value after evaluating the request_time using a case when statement.
here 's the table
userinput_id session_id request_time ...
|
by: drvcm |
last post by:
Hello everyone and thank you in advance,
This is been driving me crazy, in running the following query, I get the error 1064, below please find the full query and the error message.
There must be...
|
by: Mani Raja |
last post by:
When I execute the below query im getting the following error
Msg 102, Level 15, State 1, Line 13
Incorrect syntax near ')'.
Any one please give a solution to solve this.
In the below query...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| | |