Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
How to split column values before grouping them using sqlite and sequelize?

I'm fairly new to JavaScript and don't know how to perform the following action. I have a table named info in the database which is similar to below

id city description
10 Paris some desc
2 New York some desc
4 Munich some desc
7 Paris;2 some desc
17 Munich;2 some desc

I want to get the highest id based on the city so I have written this filter which gets called using await models.city.findAll(options);

if (filtered) {
  options.where = {
     id: {
       $in: models.sequelize.literal('SELECT MAX(id) from info GROUP BY city'), 
    },
  };
 }

Now as you can see the following works only if the city field was not overloaded by in my case some other processes modifies that and concatenates a number with ; used as a delimiter.

What I want to do is for this filter to work by grouping by city and splitting using the delimiter to avoid getting duplicates.

I'm not sure how to do this using sequelize as I'm fairly new to this.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!