DataBase - Query With Mutliple Criteria on Single Field

Asked By NPell
20-Jan-10 03:50 PM
Hi, i am trying to get a count of a certain criteria but in different
columns.

Its hard to explain, but assume i have a table which consists of...

A   550
B   600
C   20
A   100
C   75
B   120
D   390

Then in a query I am trying to have the result of:
Over 500            Over 100      Over 25      Under 25
A           1                        1
0                 0
B           1                        1
0                 0
C           0                        0
1                 1
D           0                        1
0                 0

The way i have done it was do 4 queries for that criteria, then try
and do a count from those queries.
im just getting myself in a mess.

any help would be greatly appreciated.
Office
(1)
Group.anyway
(1)
  giorgio rancati replied to NPell
20-Jan-10 12:21 PM
Hi NPell,

this is an Italian News Group.
anyway this query shows the result.
----
SELECT Field1,
SUM(Iif(Field2>500,1,0)) AS [Over500],
SUM(Iif(Field2 Between 100 AND 499,1,0)) AS [Over100],
SUM(Iif(Field2 Between 25 AND 99,1,0)) AS [Over25],
SUM(Iif(Field2<25,1,0)) AS [Under25]
FROM Table1
GROUP BY Field1
----

bye
--
Giorgio Rancati
[Office Access MVP]
Create New Account
help
Word 2002 - Marco security settings DataBase Hope I have the right group. . Anyway, , I have been trying to make new address labels in microsoft word and I keep your Marco security settings." WHAT IS THAT. Can someone please help - - ~Angela Access Macros Discussions Office (1) Word (1) Database (1) DougSteele (1) Macros (1) Sorry, you do not have the newsgroup is for questions about Macros in Access, the database product that is part of Office Professional. Macros in Access are very different than macros in any other Office product. You'd be best off reposting your question to a newsgroup related to Word e-mails, please) keywords: Word, 2002, -, Marco, security, settings description: Hope I have the right group. . Anyway, , I have been trying to make new address labels in microsoft word and I keep
at the departmental level and so by policy must be built in(to) an MS Office application, so no web interfaces, no Java, no nothing but MS Office. Good thing I am comfy with Access :-) I am curious to hear other ideas and A. Per James A. Fortune (1) SQL Server (1) MySQL (1) Oracle (1) Series (1) Office (1) Distributed (1) Hi I have just had to synchronise 10 legacy Access databases with database. That's what the Access team now recommends as best practice. Larry Linson Microsoft Office Access MVP Thanks for the feedback guys, I appreciate it. In the past I have Linked Table Manager because of the number of manual operations required. Regards, Larry Linson Microsoft Office Access MVP it Just from observation at user group demonstrations, not personal use of VB DotNet for web-based and enterprise-level applications, not for identical projects. Larry Linson Microsoft Office Access MVP m: Do you really know what a DSN is? It does not have reliability here. Did I mention I am not the biggest fan of this companies IT group. . . . . . . Anyway, sorry for any confusion. I really appreciate the feedback you all have provided. It seems
Shell DataBase Hello All This works: Dim stAppName As String stAppName = "C: \ Program Files \ Microsoft Office \ Office \ WINWORD.EXE C: \ pay \ Let \ exampleletter.doc" Call Shell(stAppName, 1) but if I replace the stAppName assignment with : stAppName = "C: \ Program Files \ Microsoft Office \ Office \ excel.EXE C: \ Documents and Settings \ les \ My Documents \ statement 548786.xls" . . . it does not but no joy. Any suggestions? Thanks for any help. Leslie Isaacs Access Forms Coding Discussions Office (1) Application.FollowHyperlink (1) VBA (1) DouglasThanks (1) ShellExecute (1) DougSteele (1) Actually, I am surprised that the first one works. Try: stAppName = """C: \ Program Files \ Microsoft Office \ Office \ excel.EXE"" " & _ although easier would be to use Application.FollowHyperlink, rather than Shell: Application Shell description: Hello All This works: Dim stAppName As String stAppName = C: \ Program Files \ Microsoft Office \ Office \ WINWORD.EXE C: \ pay \ Let \ exampleletter.doc Call Shell(s
Converter for Office 2008 documents to Office 2007 or Office 2003 DataBase I am constantly running into files created on an Apple using Office 2008 failing to open in Office 2007 or Office 2003. Is there some sort of converter like the 2007 converter that I can download Access Discussions Office 2003 (1) Office 2007 (1) Office (1) Bontrager (1) Yes. http: / / www.microsoft.com / mac / downloads.mspx - - Jerry