Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6878763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:45:50+00:00 2026-05-27T04:45:50+00:00

Here is my Tables data Tickets +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + id | tic_files | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +

  • 0

Here is my Tables data

Tickets

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ id | tic_files                                                      |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1  | 56456sasd.jpg,asd4455asd.jpg,asd564asd5.txt,asd564asd.css      |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2  | 56a4sdasd.txt,jkasd5ass.jpg                                    |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 3  |                                                                |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 4  | asdjhagsd.gif,spsnd65asd.php,56a4sd54asd.txt                   |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Comments

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ id | tic_id |  com_files                                                     |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1  | 1      |  56456sasd.jpg,asd4455asd.jpg,asd564asd5.txt                   |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2  | 3      |  56a4sdasd.txt,jkasd5ass.jpg                                   |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 3  | 1      |  sdf54sdf.gif,swrsdf54sdf.rar                                  |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 4  | 2      |  asdjhagsd.gif,spsnd65asd.php,56a4sd54asd.txt                  |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

Here Is My Problem And My retries

I want Result To Be Like This

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  tic_id |  count(tic_files)        | count(com_files)        |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  1      |         4                |      5                  |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  2      |         2                |      3                  |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  3      |         0                |      2                  |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  4      |         3                |      0                  |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

i Tried To Do This

Join tickets with group_concat( comments ) and fetch data some thing like this

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| tic_id | tic_files                                                 |  com_files                                                                |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| 1      | 56456sasd.jpg,asd4455asd.jpg,asd564asd5.txt,asd564asd.css | 56456sasd.jpg,asd4455asd.jpg,asd564asd5.txt,sdf54sdf.gif,swrsdf54sdf.rar  |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| 2      | 56a4sdasd.txt,jkasd5ass.jpg                               | asdjhagsd.gif,spsnd65asd.php,56a4sd54asd.txt                              |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| 3      |                                                           | 56a4sdasd.txt,jkasd5ass.jpg                                               |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| 4      | asdjhagsd.gif,spsnd65asd.php,56a4sd54asd.txt              |                                                                           |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

But i will try to use more than group_concat ( in all servers limit is 1024 kb ) so i want to get count use delimiter between files ” , “

Solved

This is my query

SELECT
                  cat_id as cat__id ,
                  cat_name,(
                    SELECT count(tickets.tic_id) from tickets INNER JOIN cats on(tickets.tic_cat = cats.cat_id) where tickets.tic_cat = cat__id  group by tickets.tic_cat limit 1
                  ) as "count(tickets)",(
                     SELECT  ( LENGTH( GROUP_CONCAT(tickets.tic_files)) - LENGTH( REPLACE( GROUP_CONCAT(tickets.tic_files ) , "," , "" ) ) + 1 )  FROM tickets
                     INNER join cats on ( tickets.tic_cat = cats.cat_id )
                     WHERE tickets.tic_files != "" AND  tickets.tic_cat = cat__id
                      LIMIT 1
                   )  as "count(ticket_files)",(
                    SELECT  GROUP_CONCAT(tickets.tic_files)  FROM tickets
                     inner join cats on ( tickets.tic_cat = cats.cat_id )
                     WHERE tickets.tic_files != "" AND tickets.tic_cat = cat__id
                      LIMIT 1
                   ) as "tickets_files",
                  COUNT(comments.tic_id),(
                     SELECT  ( LENGTH( GROUP_CONCAT(comments.com_files)) - LENGTH( REPLACE( GROUP_CONCAT(comments.com_files ) , "," , "" ) ) + 1 )  FROM comments
                     INNER join tickets on ( tickets.tic_id = comments.tic_id )
                     INNER join cats on ( tickets.tic_cat = cats.cat_id )
                     WHERE comments.com_files != "" AND comments.tic_id = tickets.tic_id and tickets.tic_cat = cat__id
                      LIMIT 1
                   )  as "count(com_files)",(
                    SELECT  GROUP_CONCAT(comments.com_files)  FROM comments
                     INNER join tickets on ( tickets.tic_id = comments.tic_id )
                     inner join cats on ( tickets.tic_cat = cats.cat_id )
                     WHERE comments.com_files != "" AND comments.tic_id = tickets.tic_id and tickets.tic_cat = cat__id
                      LIMIT 1
                   ) as "com_files"
            from tickets
            INNER JOIN cats ON (tickets.tic_cat = cats.cat_id)
            INNER JOIN comments ON ( comments.tic_id = tickets.tic_id )
  group by tickets.tic_cat

and here is picture of result

Result Of My query

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:45:50+00:00Added an answer on May 27, 2026 at 4:45 am

    It is possible to count the number of occurences in a string like this:

    SELECT LENGTH( GROUP_CONCAT(DISTINCT tic_files SEPARATOR ",") ) - LENGTH( REPLACE( GROUP_CONCAT(DISTINCT tic_files SEPARATOR ",") , ',' , '' ) ) + 1 AS `TIC File Count`
    

    This works by taking the total length of the column, then subtracting the length of the column after replacing all the characters you want to search for with an empty spaces.

    So 56a4sdasd.txt,jkasd5ass.jpg will become 56a4sdasd.txtjkasd5ass.jpg, and the returned value will be 1. You just need to add 1 and you will have the total number of strings around the delimiters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the scenario: I have 2 tables with data, one is the 2009 version
Database is OracleXE and here is the problem: data gets entered in tables UPS
In trying to understand the correlation between program objects and data in tables (here:
I have problems to query my data. Here are my tables: CREATE TABLE `A`
I am using jquery data tables server side method example here http://www.datatables.net/examples/server_side/server_side.html My JSON
For these tables here (circled) https://i.stack.imgur.com/zDx8X.jpg What would the best join be to use
Here is a table structure (e.g. test): Field Name Data Type id BIGINT (20)
I have encountered a problem of placing data into the Table View. Here is
My html is like this <div id=rsContainer> <table id=rsTable><!-- DATA HERE --></table> </div> and
Please look at this image here is 3 tables , and out i want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.