sql - Group by similar string field -


a table logs files have been generated every report type in application. determine last time each report generated. files named numbers_reportname-day-time.xml.

i make query groups file names according what's between first sequence of numbers , time stamps, regex do.

is possible sql / sybase?

filename                                       generationdate  456879_report-one-20150409-164652.xml           2015/04/09         789456_report-two-20150409-131534.xml           2015/04/09          123458_report-two-20150510-121055.xml           2015/04/10           784111_report-three-20150510-100652.xml         2015/04/10             

to

filename             generationdate  report-one           2015/04/09                  report-two           2015/04/10           report-three         2015/04/10           

select regexp_substr( filename , '((report-)([a-za-z]*))' ) reportname ,         generationdate x group reportname; 

this should work regardless of how long reportname get. // in sybase


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -