ChristineMD
Board Regular
- Joined
- Jul 29, 2008
- Messages
- 53
Extracting data in a report by size.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
Using the query grid, not writing SQL statements
<o></o>
Don't need to list every size, just the smallest size and the largest size - I'm using Min/Max in two separate columns to show the smallest size and the largest. <o></o>
The database has a numeric sort code ("size"), but of course the users don't want to see this, they want the label("sizecode"). Because the label for the sort code is text, it produces the ever so intuitive Microsoft sorting where 10 comes before 2. <o></o>
So using the sort code and min/max is successful. 1<SUP>st</SUP> column has the smallest size code, and the 2<SUP>nd</SUP> column has the largest size code.
<o></o>
but, What I want to do is sort by the numeric sort code, but display the label.
<o></o>
I tried using the statements below in the query grid in two separate columns,
If I used "group" by with the above, got "cannot have aggregate function in group by clause
If I used "min/max" got "cannot hve function in aggregate expression"
Cannot not show totals, because other fields in the query depend on it.<o></o>
<o></o>
I also tried <o></o>
... but that resulted in zero results. <o></o>
<o></o>If anyone thinks the underlying SQL would be helpful, let me know, I'm just not sure it would!
Any ideas? Thanks in advance!
Using the query grid, not writing SQL statements
<o></o>
Don't need to list every size, just the smallest size and the largest size - I'm using Min/Max in two separate columns to show the smallest size and the largest. <o></o>
The database has a numeric sort code ("size"), but of course the users don't want to see this, they want the label("sizecode"). Because the label for the sort code is text, it produces the ever so intuitive Microsoft sorting where 10 comes before 2. <o></o>
So using the sort code and min/max is successful. 1<SUP>st</SUP> column has the smallest size code, and the 2<SUP>nd</SUP> column has the largest size code.
<o></o>
but, What I want to do is sort by the numeric sort code, but display the label.
<o></o>
I tried using the statements below in the query grid in two separate columns,
Code:
SmSort: IIf(Min([size]),[Sizecode])<o:p></o:p>
LgSort: IIf(Max([size]),[Sizecode])
If I used "group" by with the above, got "cannot have aggregate function in group by clause
If I used "min/max" got "cannot hve function in aggregate expression"
Cannot not show totals, because other fields in the query depend on it.<o></o>
<o></o>
I also tried <o></o>
Rich (BB code):
SmSort: [sizecode] (with min([size]) in the criteria field)
... but that resulted in zero results. <o></o>
<o></o>If anyone thinks the underlying SQL would be helpful, let me know, I'm just not sure it would!
Any ideas? Thanks in advance!