Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
Please help me with the following error i am getting ..
I am trying to retrieve the data from MS SQL database.
I am getting the ODBC read failed error. for the following sql query, which joins the two tables
select BB.ID_CO,COUNT(DISTINCT BB.ID_BAG) as NoOfBags,
COUNT(DISTINCT BB.ID_BOX) as NoOfBOXES,
BH.ID_CO
from [BAG_BOX_REPORT] BB
inner join [BAG_BOX_HISTORY] BH
on BB.ID_CO=BB.ID_CO
WHERE BH.ID_CO='7354741'
AND BR.ID_CO='7354741'
GROUP BY BB.ID_CO,BH.ID_CO;
below is the screenshot of the error i encounter
I am not getting any error, if i load the both tables individually without any join i am not getting any errors.
Thanks
Ganesh
Hi Ganesh,
Try this:
select BB.ID_CO,
COUNT(DISTINCT BB.ID_BAG) as NoOfBags,
COUNT(DISTINCT BB.ID_BOX) as NoOfBOXES,
BH.ID_CO
from [BAG_BOX_REPORT] BB join [BAG_BOX_HISTORY] BH
WHERE BH.ID_CO='7354741'
AND BR.ID_CO = BH.ID_CO
GROUP BY BB.ID_CO,BH.ID_CO;
Regards!!
You have 2 fields with same name ID_PO.
Remove one or rename
Hi Manuel
Thanks for the reply
I a getting the following error at where , with the change you suggested
Thanks
Ganesh
What error do you have on MS SQL Management Tool?
Thanks Clever
I have removed the duplicate field. I thought, since i have used the alias table name on each column name, they will be treated as different fields
Thanks a lot
Thanks for quick reply and helping me Manuel
Ganesh Vara, alias table name are not loaded into Qlik.
Select
table.fieldA
becomes fieldA
If you need the table name use this
select
table.fieldA as [table.fieldA]
Thank you...