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

Query Result Assignments?

Status
Not open for further replies.

Rickinrsm

Technical User
Nov 3, 2004
130
US
I need to find a way to assign field names in to the answer table so I can determine which results are OFFICE.. and NOT OFFICE..
Thanks much . . . Rick
q=

Query
ANSWER: :MYDIR:OfficeMarketShare.db

Coastal.DB | Price | OfficeName |

| CALC SUM ALL, CALC COUNT ALL | OFFICE.. |
| CALC SUM ALL, CALC COUNT ALL | NOT OFFICE.. |

EndQuery

if not q.executeQbe()then
errorShow()
return
endif
 
Use an 'AS...' statement.

Maybe something like


| CALC SUM ALL, CALC COUNT ALL | OFFICE.. |
| CALC SUM ALL, CALC COUNT ALL | calc "N" as "TY", NOT OFFICE.. |

| CALC SUM ALL, CALC COUNT ALL | OFFICE.. |
| CALC SUM ALL, CALC COUNT ALL | calc "Y" as "TY", OFFICE.. |

The calc "..." as "TY" statements can go in any field in the query, basically, since this creates a new field in the answer table named "TY".


Tony McGuire
"It's not about having enough time. It's about priorities.
 
You're such a genious Tony!

It worked right off.

I did look at the CALC as with a constant in the book but couldn't get it to work interactively within a query.

I kept getting the dreaded error 2 unrelated questions, etc.

Thanks again Tony.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top