Thank you, Robert! As always on target. This is better than filling the Location fields with some unneeded value. Great stuff. Man lernt nie aus!
Cheers Harvey On Tue, 2022-08-16 at 10:15 +0200, Robert Großkopf wrote: > Hi Harvey, > > > > SELECT `Location`, COUNT( `Location` ) FROM > > `Item_Management`.`Items` > > `Items` GROUP BY `Location` > > > > The result is correct for all LOCATIONS that are not empty, but > > surpisingly the blank field for the empty locations is accompanied > > by > > the value 0. How can I get the right count for the empty fields as > > well? > > Try this: > SELECT COALESCE(`Location`,'Empty') AS `Loc`, COUNT( `ID` ) FROM > `Item_Management`.`Items` GROUP BY `Loc` > > COUNT: Always use a field which should never be NULL (primary key for > example) > Set a vallue for a field, which is empta at this moment. If > "Location" > contains characters it will work with 'Empty' as shown above. > > Didn't test it! > > Regards > > Robert > -- > Homepage: http://www.familiegrosskopf.de/robert > -- To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ Privacy Policy: http://www.documentfoundation.org/privacy