Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[b]Command prompt query optimization[/b]

Status
Not open for further replies.

abcraj75

Technical User
Aug 10, 2009
13
0
0
US
Hi
I think my query in command prompt of Crystal reports 2008 is taking longer timer to read records:
Query:
Select distinct name, date from salestable where date>add_months(sysdate, -36)
I tired
select DISTINCT price_name, trade_date from era006_forward_prices where trade_date>DateAdd('m',-36,CurrentDate)
but that seems not to work.

Please suggest me another alternative to be used in crystal reports
 
Check Database > SHow SQL. You'll probably find that the date check is not there, i.e. it is being done by your machine rather than the server.

Code your adjusted data as an SQL Expression. That should fix it.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
I cannot use a sql expression since I am using command prompt along with the table, this does not allow for sql expression and group by server option. So please suggest me on the query.
 
No idea. Can anyone else help?

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
Why are you using a command for this? Are you linking the command to other tables or is it the sole datasource of your report?

-LB
 
Does the following update make any difference?

Select distinct name, date from salestable
where
to_char(date, 'YYYY/MM/DD') > TO_CHAR(add_months(sysdate, -36), 'YYYY/MM/DD')



Dana
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top