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

Sorting a query with joined tables

Status
Not open for further replies.

joatmofn

Technical User
Jan 12, 2003
72
US
My query includes 3 tables, tblWorkorders, tblCustomers, tblProperties. The tblCustomers and tblProperties are joined to tblWorkorders via an ID field, e.g., tblCustomers.ID joined to tblWorkOrders.customerID.

Further, tblWorkOrders.customerId is a lookup field, as is tblProperties.propertyId.

My query only needs fields from tblWorkOrders. However, I included tblCustomers, and tblProperties so that I could sort the query by tblCustomers.customername and tblProperties.propertyname.

Without the inclusion of these two tables, sorting the query by tblWorkOrder.customerid and tblWorkOrder.propertyid merely sort by the value contained in those fields which is long int.

I need to remove the additional tables, but still need to sort by propertyname and customername. Is there a way to do that without including the other two tables?

Thanks.
 
Uncheck the 'Show' box in the grid and it should sort by your two fields, but not show them in the results.

Leslie
 
Nope, that won't work. Doing so removes the columns from the query results.
 
> "I need to remove the additional tables, but
> still need to sort by propertyname and customername."

cannot be done if you remove the tables from the query

rudy
SQL Consulting
 
What is your SQL? What results does it show, what results do you want it to show?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top