|
-
July 22nd, 2005, 01:18 PM
#1
I hate MS Access -> Garbled text in results.
Hi, I'm coming from a MySQL background and I'm having problems with MS Access.
I'm using a VC++.NET app to query Access and have been running into problems so I decided to try my queries from Access directly.
My questions are:
1) Is there a way to simply select all fields in a table and do a group by:
Code:
SELECT Product.*, COUNT(*) FROM `Product` GROUP BY Product.[Prdouct reference]
This is easily done in MySQL but it looks like I have to type every field I want in the result when I do a function such as COUNT(*)?
What's up with that?
2) When I limit the columns in my result with something like this:
Code:
SELECT Product.[Product reference], Count(*) AS num_duplicates, Product.[Short description]
FROM Product RIGHT JOIN Product AS leftjoin ON Product.[Product reference] = leftjoin.sOriginalProdRef
GROUP BY Product.[Product reference], Product.[Short description];
I get garbled text in the `Short description` field for some reason. Does anyone know why this is happening?
thanks everyone.
-
July 22nd, 2005, 04:19 PM
#2
Re: I hate MS Access -> Garbled text in results.
Access' SQL is not the most comfrotable SQL there is, but one gets used to it after a few years of pratice.
 Originally Posted by peterfelts
1) Is there a way to simply select all fields in a table and do a group by:
My version of Access doesn't accept SELECT *, COUNT(*) either.
 Originally Posted by peterfelts
Code:
SELECT Product.[Product reference], Count(*) AS num_duplicates, Product.[Short description]
FROM Product RIGHT JOIN Product AS leftjoin ON Product.[Product reference] = leftjoin.sOriginalProdRef
GROUP BY Product.[Product reference], Product.[Short description];
I get garbled text in the `Short description` field for some reason. Does anyone know why this is happening?
I have tried your query and it is working well. Sometimes, [Short description] is empty, which is normal when sOriginalProdRef doesn't exist in Product reference. Perhaps, there are other cases that I don't see with my sample.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|