Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Posted: 02 Dec 2007 at 11:19pm
Do you mean you want to be able to copy and paste the SQL that Crystal created? Yes, you can do that. Click on Database > Show SQL Query and then copy and paste it.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
Ya. i want to copy and paste it. i tried the method you have mentioned but the "Show SQL Query" only displays 3 separated Select statement for each table. It doesnt display the linking between table and grouping is also not included. Thks
Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Posted: 04 Dec 2007 at 10:49am
That would be because the linking and grouping isn't done with SQL. However, generally speaking, it isn't hard to reproduce.
Take the SQL in the Show SQL Query result. Take all the SELECT statements and concatenate them into one big SELECT statement. Put the first FROM statement as your FROM statement. Type "JOIN" and put your second FROM statement (with the "FROM", obviously). If it's an outer join, put either "LEFT" or "RIGHT" in front of the "JOIN." Type "ON" and put the link field(s). This should look something like: "ON Table1.KeyField = Table2.KeyField". Repeat for your third FROM statement. Concatenate your WHERE clauses. Make note of any that might affect outer joins. After your WHERE clauses, type "GROUP BY" and the fields you want to group by, in the order they appear in the group expert. If you have any sorting, that goes in an "ORDER BY" clause at the end.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum