I need a Postgresql Query

Cerrado Publicado hace un año Pagado a la entrega
Cerrado Pagado a la entrega

SELECT

CASE WHEN

multi_app_documentation.nsma1_code = 'DATE' THEN TO_DATE(multi_app_documentation.nsma1_ans, 'MMDDYYYY') END AS "Procedure Date",

' ' AS "Case Confirmation Number",

ip_visit_1.ipv1_firstname AS "Patient First",

ip_visit_1.ipv1_lastname AS "Patient Last",

visit.visit_sex AS "Patient Gender",

TO_CHAR(visit.visit_date_of_birth, 'MMDDYYYY') AS "DOB",

visit.visit_id AS "Account Number",

visit.visit_mr_num AS "MRN",

' ' AS "Module",

' ' AS "Signed off DT",

CASE WHEN

multi_app_documentation.nsma1_code = 'CRNA' THEN multi_app_documentation.nsma1_ans END AS "Primary CRNA",

' ' AS "Secondary CRNA",

' ' AS "Primary Anesthesiologist",

' ' AS "Secondary Anesthesiologist",

' ' AS "Canceled Yes/No"

FROM

multi_app_documentation

INNER JOIN ip_visit_1 ON multi_app_documentation.nsma1_patnum = ip_visit_1.ipv1_num

INNER JOIN visit ON ip_visit_1.ipv1_num = visit.visit_id

WHERE

multi_app_documentation.nsma1_code = 'DATE' AND TO_DATE(multi_app_documentation.nsma1_ans, 'YYYYMMDD') = CURRENT_DATE

ORDER BY

ip_visit_1.ipv1_lastname;

The problem is that the multi_app_documentation.nsma1_ans field is VARCHAR. The information is entered as 01/23/2023 or 01232023 or 1/23/23 or 2/09/2023 or 2/9/2023. Because of this it is generating errors when I try to convert the string to date in the SELECT statement and in the WHERE statement.

> ERROR: invalid value "12/1" for "YYYY"

DETAIL: Field requires 4 characters, but only 2 could be parsed.

HINT: If your source string is not fixed-width, try using the "FM" modifier.

> Time: 3.587s

PostgreSQL PostgreSQL Programming

Nº del proyecto: #35820432

Sobre el proyecto

8 propuestas Proyecto remoto Activo hace un año

8 freelancers están ofertando un promedio de $123 por este trabajo

masterblockchain

Hello Happy new year! I am a full stack web/mobile and blockchain developer. I am sure I can handle this project sucessfully. I can start now. Regards

$140 USD en 7 días
(0 comentarios)
0.0
yevhenrosovskii

Hello, there! How are you! I am a sql expert. I've read your explanation carefully. I'm confident with your project. I can work right now. Please contact to me. Looking forward to hearing from you. Thank you.

$140 USD en 7 días
(0 comentarios)
0.0
vimpalshah

I can help to fix the error of your query. I can prepare query as per your requirement. I am c# .net programmer having 14+ years of experience in developing and handling different type of applications. I believe in qu Más

$120 USD en 7 días
(0 comentarios)
0.0
julynguyen322

========= PostgreSQL ========= Hi, dear client! I am happy to tell you about my skills I have read your requirement and I noticed that I am appropriate to this project. I have rich experiences with website development Más

$100 USD en 3 días
(0 comentarios)
0.0
mannnupatel

I have more than 14 years of IT experience with various database technologies. Working Knowledge of Oralce,postgres Databases. Strong experience in Oracle to postgres migration Strong Oralce Development Skills working Más

$140 USD en 7 días
(0 comentarios)
0.0
pedroarnedo

I am a Computer Engineer, I am certified as an ethical hacker by ECCouncil and I have a Master's in Computer Security. I have more than 15 years of professional experience in this area. I also have 27 years of experien Más

$110 USD en 7 días
(0 comentarios)
0.0
Yogidhan1988

I have gone through your errors and ready to fix that.. i have a 12 years of experience in this field.

$30 USD en 1 día
(0 comentarios)
0.0