![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
![]() |
Tue, Mar 10 2009 10:12 PM | Permanent Link |
Greg | Hi,
I have experienced this COUNT (aggregation) issue in a variety of ways. In it's simplest form... If MyTable contains (say) 99 records then SELECT 'MyComment' ,COUNT(*) FROM MyTable returns the results: 'MyComment' and 99 If MyTable contains no records then SELECT 'MyComment' ,COUNT(*) FROM MyTable returns the results: NULL and 0 How can I force the column expression of 'MyComment' to be returned when MyTable is empty. I would like to avoid having to wrap the queries in an EXISTS tests. Hope you can assist. Regards Greg |
Wed, Mar 11 2009 4:40 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Greg
How about COALESCE - don't know if it will work in this case but worth a go Roy Lambert [Team Elevate] |
Wed, Mar 11 2009 4:55 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Greg,
<< How can I force the column expression of 'MyComment' to be returned when MyTable is empty. >> Seeing that this is a constant, I'll see about changing the behavior so that it is always returned for single-row result sets. The way it is now isn't really correct. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |