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!

Change Font Color in SQL Query

Status
Not open for further replies.

jrshaw03

Technical User
Jan 14, 2005
18
US
I am using an SQL query which unions all of my fields together soas to preserve a certaing format:

Heading (A)
Field Entry 1 (for A)
Field Entry 2 (for A)
...
Heading (B)
Field Entry 1 (for B)
Field Entry 2 (for B)
...

To do this I use:

SELECT DISTINCT "a _GENERAL ITEMS" as Category, [General Items] as Item from [Mk 36 01Jan Source] WHERE NOT [General Items]=""

UNION ALL SELECT DISTINCT "c _APP FUNDING", [Blank Space] FROM [Mk 36 01Jan Source]

This query alphabetically sorts all of my fields so APP would come before General Items. To get around this, I put in the 'a' and 'c' characters to get the order I want. This method although effective is not very pretty.

For a shortcut, Is there a way to color the 'a', 'c', etc white so they would not show up on a report?

Thank you very much for your help,

Jimmy Shaw
 
Have you tried this ?
SELECT DISTINCT "GENERAL ITEMS" as Category, [General Items] as Item from [Mk 36 01Jan Source] WHERE NOT [General Items]=""
UNION ALL SELECT DISTINCT "APP FUNDING", [Blank Space] FROM [Mk 36 01Jan Source]
ORDER BY 1 DESC, 2 ASC;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the suggestion, but this doesn't do it for me. When I look at the data in the query, it is in the correct order, but when I take it to the report everything goes to alpha order. The report does have Ascending sorting on Category under the sorting and grouping option, and I cannot seem to turn this feature off. If I delete Category from the sorting field/expression, an error comes up when I preview the report saying 'You must define a Sort Field or Expression for the Rgoup Header or Footer in the Report..

Thanks,
Jimmy Shaw
 
You can't have Descending sorting on Category ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry, poor job of explaining. There are more than General Items and APP. There is Procurement, Enineering..., total of 9 different names that all need to be intermixed alphabetically to yield the correct order.

Thanks,

Jimmy Shaw
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top