user3781174
user3781174

Reputation: 235

Search for groups of first words

I have a table called 'fazerbem_dates' and dates are stored as follows:

09/08/2014 12:34:23 PM
09/08/2014 12:34:23 PM
09/08/2014 12:34:23 PM
10/08/2014 02:12:06 PM
10/08/2014 02:12:06 PM
10/08/2014 15:12:54 PM

And I'm picking dates for groups, as you can see in syntax below for sqlite3:

SELECT * FROM fazerbem_dates group by mine_dates

This syntax returns me only 3 rows:

09/08/2014 12:34:23 PM
10/08/2014 02:12:06 PM
10/08/2014 15:12:54 PM

he pulls the right way, but in my case I just wanted him to get the records by groups but with one exception: it only will consider only the first 10 letters of the string, thus making it return me only 2 records that are:

09/08/2014 12:34:23 PM
10/08/2014 02:12:06 PM

It is possible to do in sqlite syntax? If possible how I can do that?

Upvotes: 0

Views: 17

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269623

Did you try this?

select min(fazerbem_dates)
from table t
group by substr(fazerbem_dates, 1, 10);

Upvotes: 2

Related Questions