Access Query Question:
Using Access 2003 SP2.
I wanted to use the 'GROUP BY ALL' command but apparently this cannot be used with remote tables and Microsoft no longer support the 'ALL' command with future releases.
I want a list of all referral sources for all new customers regardless of whether they have placed an order or not - if a group has no orders placed I want the count to be 0.
e.g. code:
Expand|Select|Wrap|Line Numbers
- SELECT Customer.Refer, Count(*) AS Orders
- FROM Customer
- WHERE (((Customer.Date) Between #1/1/2007# And ((#1/8/2007#)+1))
- AND ((Customer.Notes) Like '*<Orders>*1*</Orders>*'
- Or (Customer.Notes) Like '*<Orders>*2*</Orders>*'
- Or (Customer.Notes) Like '*<Orders>*3*</Orders>*'
- Or (Customer.Notes) Like '*<Orders>*4*</Orders>*'
- Or (Customer.Notes) Like '*<Orders>*5*</Orders>*'
- Or (Customer.Notes) Like '*<Orders>*6*</Orders>*'
- Or (Customer.Notes) Like '*<Orders>*7*</Orders>*'
- Or (Customer.Notes) Like '*<Orders>*8*</Orders>*'
- Or (Customer.Notes) Like '*<Orders>*9*</Orders>*'
- Or (Customer.Notes) Like '*<Orders>*0*</Orders>*'))
- GROUP BY Customer.Refer
Expand|Select|Wrap|Line Numbers
- REFER | ORDERS
- <NULL> | 500
Expand|Select|Wrap|Line Numbers
- REFER | ORDERS
- <NULL> | 500
- REFA | 0
- REFB | 0
- REFC | 0
"Syntax Error (missing operator) in query expression 'ALL customer.refer'"
Note: On a separate point my 'Where' clause looks complicated because I only know if an order has been placed by looking at a 'memo' field searching for the following pattern "<Orders>####<Orders/>" (where #### can be any number combination - I have not been able to find an easier way to search for a string pattern (any guidance would be greatly appreciated).