cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Analitika
Post Prodigy
Post Prodigy

Error in SQL in postgresql in power bi advanced editor

Hello,

 

I have errror in sql. I am getting this error.

 

Error message:

 

DataSource.Error: ODBC: ERROR [42601] ERROR: syntax error at or near ".";
Error while executing the query
Details:
DataSourceKind=Odbc
DataSourcePath=dsn=dbname
OdbcErrors=[Table]

 

Below is SQL command:

 

SELECT rws.zu0_kod AS zu0_kod,
rws.did_nr AS did_nr,
rws.adm_var AS adm_var,
rws.did_dat AS did_dat
,COUNT (1) AS eil.skaicius
FROM (SELECT tab1.zu0_kod,
tab1.did_nr,
tab1.adm_var,
tab1.did_dat
FROM (SELECT id_vidp AS id_vidp2,
zu0_kod AS zu0_kod,
AS did_nr,
adm_var AS adm_var,
did_dat AS did_dat
FROM a.vidp
WHERE a.vidp.did_dat >= filterdate) tab1
LEFT OUTER JOIN a.vidp tab2
ON tab1.id_vidp2 = tab2.id_vidp) rws
GROUP BY rws.zu0_kod,
rws.did_nr,
rws.adm_var,
rws.did_dat

 

I have tried writing 'eil.skaicius', "eil.skaicius", ``eil.skaicius``, `eil.skaicius`. But these not helped, still getting the same issue. How I could fix it?

1 ACCEPTED SOLUTION
FarhanAhmed
Super User
Super User

 

SELECT rws.zu0_kod AS zu0_kod,
rws.did_nr AS did_nr,
rws.adm_var AS adm_var,
rws.did_dat AS did_dat
,COUNT (1) AS eil_skaicius
FROM (SELECT tab1.zu0_kod,
tab1.did_nr,
tab1.adm_var,
tab1.did_dat
FROM (SELECT id_vidp AS id_vidp2,
zu0_kod AS zu0_kod,
AS did_nr,
adm_var AS adm_var,
did_dat AS did_dat
FROM a.vidp
WHERE a.vidp.did_dat >= filterdate) tab1
LEFT OUTER JOIN a.vidp tab2
ON tab1.id_vidp2 = tab2.id_vidp) rws
GROUP BY rws.zu0_kod,
rws.did_nr,
rws.adm_var,
rws.did_dat

 

Does this query works for you in Postgre SQL Editor. ? Try to remove "." in eil.skaicius and replace it with "_" and see if works

 







Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
FarhanAhmed
Super User
Super User

 

SELECT rws.zu0_kod AS zu0_kod,
rws.did_nr AS did_nr,
rws.adm_var AS adm_var,
rws.did_dat AS did_dat
,COUNT (1) AS eil_skaicius
FROM (SELECT tab1.zu0_kod,
tab1.did_nr,
tab1.adm_var,
tab1.did_dat
FROM (SELECT id_vidp AS id_vidp2,
zu0_kod AS zu0_kod,
AS did_nr,
adm_var AS adm_var,
did_dat AS did_dat
FROM a.vidp
WHERE a.vidp.did_dat >= filterdate) tab1
LEFT OUTER JOIN a.vidp tab2
ON tab1.id_vidp2 = tab2.id_vidp) rws
GROUP BY rws.zu0_kod,
rws.did_nr,
rws.adm_var,
rws.did_dat

 

Does this query works for you in Postgre SQL Editor. ? Try to remove "." in eil.skaicius and replace it with "_" and see if works

 







Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




View solution in original post

Also upon checking further it seems that your inner query contains error

 

SELECT rws.zu0_kod AS zu0_kod,
rws.did_nr AS did_nr,
rws.adm_var AS adm_var,
rws.did_dat AS did_dat
,COUNT (1) AS eil_skaicius
FROM (SELECT tab1.zu0_kod,
tab1.did_nr,
tab1.adm_var,
tab1.did_dat
FROM (SELECT id_vidp AS id_vidp2,
zu0_kod AS zu0_kod,

[ColumnName is MISSING HERE] AS did_nr,


adm_var AS adm_var,
did_dat AS did_dat
FROM a.vidp
WHERE a.vidp.did_dat >= filterdate) tab1
LEFT OUTER JOIN a.vidp tab2
ON tab1.id_vidp2 = tab2.id_vidp) rws
GROUP BY rws.zu0_kod,
rws.did_nr,
rws.adm_var,
rws.did_dat






Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!