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 9185549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:18:16+00:00 2026-06-17T19:18:16+00:00

Possible Duplicate: how to select count from main query into subquery I want to

  • 0

Possible Duplicate:
how to select count from main query into subquery

I want to get the number of records that are selected in the main query into a subquery

Query that i am currently trying to execute is:

SELECT
    cat_id,
    category_name,
    seo_name,
    (
        SELECT count(category_name)
        FROM ccs_coupons
        WHERE website_name LIKE category_name
           OR description LIKE category_name
           OR url_desc LIKE category_name
    )  AnyAlias 
FROM  `ccs_coupons`
WHERE  category_name like 'a%'
GROUP BY category_name
ORDER BY category_name ASC
LIMIT $page,$config
  • 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-06-17T19:18:18+00:00Added an answer on June 17, 2026 at 7:18 pm

    Try this:

    SELECT
        cat_id,
        category_name,
        seo_name,
        (
            SELECT COUNT(category_name)
            FROM ccs_coupons c2 
            WHERE c2.category_name LIKE CONCAT('%', c1.category_name, '%')
               OR c2.website_name LIKE CONCAT('%', c1.category_name, '%')
               OR c2.description LIKE CONCAT('%', c1.category_name, '%')
               OR c2.url_desc LIKE CONCAT('%', c1.category_name, '%')
        )  AnyAlias 
    FROM  `ccs_coupons` c1 
    WHERE  category_name LIKE 'a%'
    GROUP BY category_name
    ORDER BY category_name ASC
    LIMIT $page,$config
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: mysql count into PHP variable I have the following query that returns
Possible Duplicate: MYSQL COUNT GROUP BY question $query = SELECT * FROM product_id_1; $result
Possible Duplicate: Writing an SQL query to SELECT item from the following table I
Possible Duplicate: How can I count the numbers of rows that a mysql query
Possible Duplicate: How do we count rows using Hibernate? I want count number of
Possible Duplicate: How do I randomly select an item from a list using Python?
Possible Duplicate: TSQL Writing into a Temporary Table from Dynamic SQL ALTER PROCEDURE [dbo].[usp_ServicesStats1](@PERIOD
so suppose I have this query SELECT COUNT(*) FROM (SELECT * FROM k JOIN
Possible Duplicate: Hibernate HQL: Get count of results without actually returning them I have
Possible Duplicate: Looping through mysql_fetch_array in PHP I have a simple join query that

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.