Avatar of hraja77
hraja77
 asked on

sql query

Hi,

I have a table which logs all reboots of a till on our system;
I need a query to see on a particular day how many tills rebooted - problem is that some times a till may reboot 3 times in a day and record three records into my table but i only need to show this as one:

my table is called audit: columns are:

id
timestamp
tillname

thanks
H
Oracle DatabaseSQL

Avatar of undefined
Last Comment
Hamed Nasr

8/22/2022 - Mon
rmandra

select tillname, to_char(timestamp,'mm-dd-yyyy') as Reboot_Day, count(*)
from audit
group by tillname, to_char(timestamp,'mm-dd-yyyy')
hraja77

ASKER
hi,

on one day the till will reboot more than once but i only want to record the fact it rebooted once

thanks
H
ASKER CERTIFIED SOLUTION
Ess Kay

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Gerwin Jansen

Can you show a sample of your required output? The answer that rmandra gave looks OK to me. Do you want to show just the days that have reboots? Then it's just a distinct, something like this:

select distinct(to_char(timestamp,'mm-dd-yyyy'))
from audit;
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Hamed Nasr

Try to select till_id  , max(reboot time) , and count(),  Grouping By till_id.