The first 7 characters of logfilename contain a machine part number and the rest is a unique time stamp.
I would like to count the number of times a particular machine has an alarm. The following code allows me to select the distinct machine names from the table.
select distinct(substr(logfilename, 1, 7)) from rlad_detected;
I have been wracking my brain on how to write the code to actually count the number of alarms that occurred for each machine. I came up with this, but it does not execute properly.
select alarm,Count(*) from rlad_detected group by distinct(substr(logfilename, 1, 7));
When I do this, it highlight's the 'd' in distinct and says "missing expression," which is supposed to mean that I'm missing a required part of a clause, but I'm not sure what I've done wrong.
I'm really hoping someone could give me a hand here. I've never programmed in SQL before this week. Thanks. Hope life is good.

New Topic/Question
Reply


MultiQuote




|