I have the following columns in Table A which records users fingerprint "transaction" every time they check in or check out from a building.
CREATE TABLE user_transactions (
id serial PRIMARY KEY,
staff_id INT4,
transaction_time TIMESTAMP,
transaction_type INT4
);
In a single day a user can have many transactions. How can I create a view that with the following stucture?
staff_id INT4
transaction_date DATE
first_transaction TIMESTAMP --first finger scan of the day
last_transaction TIMESTAMP --last finger scan of the day
number_of_transaction INT4 --how many times did the user scan for the day