Click to See Complete Forum and Search --> : Can I Edit the SQL Query in Crystal Report 9?


quahch77
July 2nd, 2006, 11:28 PM
Hi,
Can I Edit the SQL Query in Crystal Report 9?

i just can see the SQL query at "Database"->"Show SQL Query". How do I edit it in Crystal Report?

thank you.

JaganEllis
July 3rd, 2006, 12:06 AM
In "Database"->"Database Expert".
Edit the command directly if you have a command, or a graphically if you have a list of tables and joins.

quahch77
July 3rd, 2006, 01:49 AM
In the "Database"->"Database Expert", i only see 2 tabs which are "Data" & "Links" (both are graphical).

i cannot see any "Edit" or the command.

BTW my CR version is 9.2.

JaganEllis
July 3rd, 2006, 10:37 PM
What exactly do you want to edit about the 'query'?
You add/remove tables in the Data tab, and change the joins in the Link tab - i.e. you do it graphically and the SQL query Crystal runs is altered appropriately.
You add data restrictions (where clause) in the Record Selection formula (Report menu, Selection Formulas, Record)

quahch77
July 4th, 2006, 06:11 AM
Actually... I want to sort out and display the latest transaction to my report.

eg:
In my table:
Item CustOrder Price
A C1 1.90
A C1 2.10
A C1 2.00
B C8 33.90
B C8 32.00

In my report show:
Item CustOrder Price
A C1 2.00
B C8 32.00


So initially i want to use SQL Statement "Group By" clause to sort it out and display, but later i found it got some problem / the record displayed is not correct.

any idea? or what can i do?

thank you.

JaganEllis
July 4th, 2006, 07:15 PM
Then your SQL is fine; you want to use the Group Expert to group on the column that contains the 'A', 'B' etc. values and then the column for the 'C1', 'C8' etc. values. You might then want to use the Record Sort Expert to order the records within these groups (e.g. is there a timestamp to order them in 1.90, 2.10, 2.00 order?) and display the row you want in the group footer (i.e. suppress the detail).