kpddong
1
i have a table
records
------------
id | user | time | event
91 admin | 12:00 | hi
92 admin | 11:00 | hi
93 admin | 12:00 | bye
94 admin | 13:00 | bye
95 root | 12:00 | hi
96 root | 12:30 | hi
97 root | 12:56 | hi
how could i only select and display only the user and event from times between 12:00-12:30? (and sort them by id if i can)
so it would show
91 admin hi
93 admin bye
95 root hi
96 root hi
when i use select user, host from record LIMIT 1;
it only displays the first.
kinda lost! help plwould be appreciated!
cabrao
2
$ awk '{gsub(":","",$4)};$4>=1200&&$4<=1230{print $1,$2,$NF}' file
Not got SQL on this machine but try
SELECT user, host FROM record WHERE time >= 12:00 AND time <= 12:30;
I think you need to add quotes:
select user, host from records where time between "12:00" and "12:30";
But that won't work either since the field "host" does not exist.
1 Like
Good spot
So your probably after
SELECT id, user FROM record WHERE time >= "12:00" AND time <= "12:30";
1 Like
kpddong
7
know this is late but thanks!