Run a Query
You can write your own Queries, copy/paste a query from Query Examples, or select one of your Favorites.
- Copy the query text to the clipboard.
- In the Main Menu, click Reports, User Query.
- Click in the upper left text box, then click Paste. The query text from the clipboard should show in the box. To resize the text box, drag the horizontal splitter down/up. If using Random Primary Keys, queries with CREATE TABLE or DROP TABLE syntax can only run on the computer named as the User Query Server on the Replication Setup window.
- Click Submit Query. The resulting table will show in the bottom section of the window. When long queries are run, the Submit button will change to Stop Execution. Click to cancel a large query that may take a long time to run.
Note: The Command Query Permission allows/blocks users from running SQL commands (non-SELECT statements) on normal tables. It will also block queries with semicolons in comments.
Working with Query Results
Query results can be long and wide, depending on the data retrieved.
- Use the vertical and horizontal scrollbars to move up and down, left and right.
- Sort Order: Click a column header to change the sort order of results. The first click orders the row in ascending order (a small up arrow will show in the header); the second click sorts the rows in descending order. This only affects the view of the data; not the actual data itself. Results are sorted alphabetically by strings or words. If you want to sort by something else you will need to specify it in the query itself.
- Column widths: To change, drag the line between headers. Changed widths are not saved as part of query.
- Copy: Copy the current query to the clipboard.
- Format: View the table (query results) in human-readable or raw format. The example above is human-readable format. The raw format would not show the extra zeros on the dollar amounts. See Formatting Raw Data.
Once you have the table the way you want it, you have several options.
- Print Preview: View the query like a printed report. Some columns will show a grand total at the bottom of the report while in preview mode. You can Zoom in or use the blue arrows to scroll through pages. Click Query View to return to regular query view.
- Print: Print the query to the default printer.
- Export: Save the file as a tab delimited text file or Excel file to use in a spreadsheet program or a letter merge. See Using Data in Other Programs.
- Add to Favorites: Save the current query in your Query Favorites. This is good practice since queries can take time to write, and one small typo can cause an error. Click Favorites to view all queries in your favorites list.
Hint: To include a title/header on printed query results, save the query to your Query Favorites, and enter the title. Then, run the query again.