I have written a MYSQL script and am having trouble to get the results I need. Its hard to explain what I am trying to do so here is an example.
This is my MYSQL script:
SELECT device_uuid,
gender,
day_epoch,
hour,
age
FROM daily_stats_venue_unique_device_uuids_per_hour
WHERE (day_epoch + (3600*hour)) >= 1519171200
AND (day_epoch + (3600*hour)) < 1519340400
AND venue_id = 4
GROUP BY device_uuid
and this is returning these results:
(There are 2 device_uuid in there which looks very similar but one has a 6 instead of a 5 near the start. Sorry about that it makes my next screenshot more confusing but please look closely.)
but when I modify the group by to this: GROUP BY device_uuid, gender
I get these results:
As you can see there are 2 records with the same device_uuid (records 2/3) but they have different genders. I want to use the first query I showed you but if a record has a gender I would like to get that result instead of the one without a gender.
Thank you for any help in advance