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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:22:39+00:00 2026-05-26T07:22:39+00:00

I have a column called @months which stores months in this format @month =

  • 0

I have a column called @months which stores months in this format

@month = ’01-03-05-11-12′

I would like to have a SELECT query that divides this column into 12, making it Jan, Feb, March

Each of my record has this column in front. So if a record has @month = ’01-03′ in it, it shows under January and March. Can something like that be done? Or anything close is good enough.

I played with case statement but could not produce the results.


Code if anyone wants to try

create table recs(
id int not null primary key,
cust_name varchar(20),
callmonth varchar(36)
)

insert into recs values(1,'john','01-12')
insert into recs values(2,'Jessica','02-06')
insert into recs values(3,'Charlie','01-06')
insert into recs values(4,'steale','03-04')
insert into recs values(5,'Silica','01-02-03-04-05-06-07-08-09-10-11-12')
insert into recs values(6,'Luder','01-03-05-07-09-11-12')
insert into recs values(7,'Panther','01-06-12')
insert into recs values(8,'Dinky','03-04-15')
  • 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-26T07:22:40+00:00Added an answer on May 26, 2026 at 7:22 am

    I may be unclear about what you are trying to do, but you can devide into 12 tables using the following:

    INSERT INTO January_table
    SELECT *
    FROM Original_table
    WHERE month LIKE '%01%';
    

    Do this for each month and it should give you 12 tables containing only the values that have that month. You could then use a view to combine them.

    Alternatively, if you are looking for one query, you might be able to use a case statement like the one below:

    INSERT INTO table
    SELECT *
        CASE
        WHEN month LIKE '%01%' THEN 'True'
        ELSE 'False'
        END,
        CASE
        WHEN month LIKE '%02%' THEN 'True'
        ...
    FROM Original_table;
    

    This will yield a table with all fields from the original table, followed by 12 “monthly columns” each with a true or false representing whether that month is present in that row.

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

Sidebar

Related Questions

I have a column called menu_order which has no default value. When I select
I have the column DateTimeExpired, and I would like to create another column called
I have column called 'last updated' of this format: 2009-10-13 09:20:30 and I want
I have a datecolumn called invoicedate, my query is: select MONTH(dbo.tblInvoices.InvoiceDate) as datemonth, Year(dbo.tblInvoices.InvoiceDate)as
I have a column called body , which contains body content for our CMS.
Suppose I have a column called fruits I want to select all of the
In mysql database i have this column called: Name: Date Type: datetime I have
I have a DataTable that has a boolean column called [Invalid]. I need to
I have a column called THE_VALUE in a table TABLE_A , that holds data
I have a computed column called Cost that returns money. I want to have

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.