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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:00:02+00:00 2026-06-12T21:00:02+00:00

I checked the Search, but none seem to answer this Question.. I expect it

  • 0

I checked the Search, but none seem to answer this Question.. I expect it to be farely simple though:
I have a query that results in two columns, but I need it to result in two rows.. Anyone know how?

this is the query:

               SELECT        (SELECT        COUNT(Id) AS Expr1
                      FROM            Table
                      WHERE        (Description LIKE 'door%')) AS Door,
                         (SELECT        COUNT(Id) AS Expr1
                           FROM            Table AS Table_1
                           WHERE        (Description LIKE 'window%')) AS Window

The result I GET is (of course):

[Door]     [Window]
56         34

The result I’d LIKE to have is the following:

[OPTION]    [NROfRecords]
Door        56
Window      34

Any Ideas? Thanks in advance!

  • 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-12T21:00:04+00:00Added an answer on June 12, 2026 at 9:00 pm
    SELECT 'Door'   AS Option, COUNT(id) FROM table WHERE description LIKE 'door%'
    UNION ALL
    SELECT 'Window' AS Option, COUNT(id) FROM table WHERE description LIKE 'window%'
    

    OR…

    WITH
      filtered AS
    (
      SELECT
        CASE WHEN description LIKE 'door%'   THEN 'Door'
             WHEN description LIKE 'window%' THEN 'Window'
                                             ELSE 'Other' END AS option,
        *
      FROM
        yourTable
      WHERE
           description LIKE 'door%'
        OR description LIKE 'window%'
    )
    SELECT
      option,
      COUNT(id)
    FROM
      filtered
    GROUP BY
      option
    

    Or…

    SELECT
      lookup.option,
      COUNT(id)
    FROM
    (
      SELECT 'door'   AS option
      UNION ALL
      SELECT 'window' AS option
    )
      AS lookup
    INNER JOIN
      yourTable
        ON yourTable.description LIKE lookup.option + '%'
    GROUP BY
      lookup.option
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I checked out the search, but none of the questions seem to (clearly) answer
I'm writing a search form for my Rails (2.3.9 but I've checked that this
I've noticed that this question has been asked several times but none of the
This seems like a common question but search is not returning anything. I have
I checked the documentation, but can't seem to find what I'm looking for. I
I checked throught the existing topics. I have a fix for my problem but
I have a form like this: <form id=form_main name=form_main action=/search/ target=iframe001 method=get onSubmit=reset_and_subm();> Enter
I have search with the following keyword but couldn't find. javascript CheckBoxList api jquery
This seems easy but haven't found the magic search term yet. One table ID
i really need some help with this..i have done a lot of search and

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.