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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disappearing columns from the SELECT statement

Status
Not open for further replies.

speeves

Programmer
Aug 2, 2000
1
US
I am writing a report for a Work Order for the workers to take out across campus and I am not able to add columns to the select part of my query.  Can someone help?!Here is my query...SELECT    Prio."PriName",    WO."WONum", WO."WOFY", WO."CName", WO."Dept", WO."Phone", WO."Acct", WO."Descr", WO."DateReq", WO."DateDue", WO."EstCost",    Queues."QName",    Bldgs."BName"FROM    "Plant"."dbo"."Prio" Prio,    "Plant"."dbo"."WO" WO,    "Plant"."dbo"."Queues" Queues,      "Plant"."dbo"."Bldgs" Bldgs,    "Plant"."dbo"."Functions" FunctionsWHERE    Functions."Fnum" =* WO."Function" and    Prio."PriNum" =* WO."Priority" AND    WO."QNum" *= Queues."QNum" AND    WO."Loc" *= Bldgs."BNum" and    WO.WONum = 7739 and    WO.WOFY = 2000
 
The editing of the SELECT part of the query is handled by CR - it automatically adds and drop fields, depending on whether they are used in the report.&nbsp;&nbsp;So, to add a field to the SELECT statement, insert it into the report.<br>They do say &quot;Show SQL Query&quot;, so I guess they don't feel obliged to make this point explicit.<br> <p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
 
A couple of things:<br>1) you normally cant edit the select clause in the Show SQL Query, because CR will rewrite it and loose your changes.&nbsp;&nbsp;So use the other menus and gui tools to add these fields.<br><br>2) I don't believe this is your problem but if you linked two or more tables you must include fields from all of the end tables in your report or thay will be optimized away.&nbsp;&nbsp;That is if you have a relation as follows A-&gt;B-&gt;C, then A and C are end tables and you must at least one field from A and at least one from C or CR will loose the relationship to C when it optimizes your query.&nbsp;&nbsp;You can use these fields in a formula or you can hided them in your report.
 
The FROM and WHERE clauses can be edited without risk of Seagate overwriting them.&nbsp;&nbsp;So Ron, if you want to &quot;lock in&quot; a method of linking tables, or a statement in the WHERE clause, you can do so by editing the SQL statement.<br>Crystal then assumes you will continue to handle all further editing of the FROM and WHERE clauses, and will stop trying to add or edit stuff in these clauses.&nbsp;&nbsp;So, if you add another table, you will have to do the linking yourself in the FROM or WHERE clause.<br>If you decide you want to give control of the SQL statement back to Crystal, hit the refresh button in the Show SQL statement.&nbsp;&nbsp;Crystal will then rebuild the FROM and WHERE clauses based on the Visual linking tool and the Record Selection formula.<br><br>Oldtimers like myself can remember when Crystal allowed us control over the GROUP BY and ORDER BY clauses as well, but now that Crystal has the &quot;feature&quot; of Server Side grouping, it will mess around with those clauses as well.&nbsp;&nbsp;Crystal has always taken full control of everything from the first SELECT statement to the start of the FROM clause. <p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top