I have a database that I have inherited. This database is used to filter organisations based on various answers that the user gives. When the final stage is reached the main query is run. This query returns duplicate organisations, which I removed in the past using DISTINCT in the select statement.
Now the client wants to be able to order the organisation output based on a sort order set in their administration system.
The problem that i am having is when I add the order by clause SQL throws a mental, and says that I can't use DISTINCT and the order by statement. but without the distinct I get duplicate organisations, which isn't acceptable.
Is there anyway that I can use the recordset from one query as the input to another one in ASP? kinda like this:
query1 = "SELECT this and that from there order by sortorder"
query2 = "SELECT DISTINCT(THIS) from Query1"
is this sort of thing possible?
I am using MS Access (unfortunatly) and the main query(query1 in the case above) is built up dynamically based on what the user has selected, over the various pages.
any help appreciated, have been banging my head against the desk for a few hours on this one!
Cheers
Tony