sql server - SQL Query to Crystal Report -


need results query:

select  cast(a.invoicedate date) invoicedate,         count(*) recordcount   salesorder   join imssalesextracthistory b     on a.slsordnbr = b.slsordnbr    , a.ordlnnbr = b.ordlnnbr    , a.ordlnseqnbr = b.ordlnseqnbr  b.safinsertdate > getdate()-2 group cast(a.invoicedate date) order cast(a.invoicedate date) 

to replicated crystal report.

i have started formula in formula workshop window within crystal reports 2013 keeps giving me error:

(   select distinct cast("salesorder"."invoicedate" date) invoicedate     "salesorder"     join "imssalesextracthistory"       on "salesorder"."slsordnbr" = "imssalesextracthistory"."slsordnbr"      , "salesorder"."ordlnnbr" = "imssalesextracthistory"."ordlnnbr"      , "salesorder"."ordlnseqnbr" = "imssalesextracthistory"."ordlnseqnbr"    "imssalesextracthistory"."filedate" > {fn curdate()} ) 

error:


sap crystal reports

error in compiling sql expression : failed retrieve data database. details: ado error code: 0x80040e07 source: microsoft ole db provider sql server description: conversion failed when converting varchar value '2016-05-25' data type int. sql state: 22018

native error: 245 [database vendor code: 245 ].

ok

i removed count(*) cs query because going use same code when got working , find count new column within report.

looking convert initial sql query has no errors in crystal reports.

edit: reference, result set need in crystal report generated sql script above.

 invoicedate    recordcount  2016-05-13     16074  2016-05-14     2  2016-05-15     4  2016-05-16     27495  2016-05-17     20023  2016-05-18     18923  2016-05-19     18944 

start crystal reports , make database connection.

instead of selecting tables select add command , paste query

select  cast(a.invoicedate date) invoicedate,         count(*) recordcount   salesorder   join imssalesextracthistory b     on a.slsordnbr = b.slsordnbr    , a.ordlnnbr = b.ordlnnbr    , a.ordlnseqnbr = b.ordlnseqnbr  b.safinsertdate > getdate()-2 group cast(a.invoicedate date) order cast(a.invoicedate date) 

now got design , place required columns in detail sectio.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -