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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:34:02+00:00 2026-06-04T18:34:02+00:00

So i have question: SELECT worker_ID as widp, DAYS, MAX(ID_WERSJI) max , funcion1 as

  • 0

So i have question:

SELECT worker_ID as widp, DAYS, MAX(ID_WERSJI) max , funcion1 as FUN1,function2 as FUN2,function3 as FUN3,function4 as FUN4,function5 as FUN5
                FROM `grafik201105`
                    WHERE 
                        funcion1 IN ('one','two','three','four','five','six') OR
                        function2 IN ('one','two','three','four','five','six') OR
                        function3 IN ('one','two','three','four','five','six') OR
                        function4 IN ('one','two','three','four','five','six') OR
                        function5 IN ('one','two','three','four','five','six') AND
                        active=1 
                        GROUP BY widp, FUN1,DAYS) as dni

And now i need to get fun1,fun2,fun3,fun4 and fun5 in one column (‘give_me_all’)
AND! in fun1=’one’ replace ‘one’ to ‘first’, if ‘two’ then second, three => third…

i try to use if(fun1=’one’,’first’,fun1) but I think that better solution here is to use CASE but i don’t know exactly how to use it

  • 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-04T18:34:03+00:00Added an answer on June 4, 2026 at 6:34 pm

    Well to combine two or more columns into one you just simply do (function1+function2+function3+function4+function5) AS give_me_all, but as I said, the best should would be to make a function for you to replace one to first and it would then go like (change(function1)+change(function2)+change(function3)+change(function4)+change(function5)) AS give_me_all, but writing a function is a more advanced thing. Try reading more here.
    Otherwise it will look ugly, but still possible

    `((CASE 
         function1 
            WHEN 'one' THEN 'first';
            WHEN 'two' THEN 'second';
      END;)+
      (CASE 
         function2 
            WHEN 'one' THEN 'first';
            WHEN 'two' THEN 'second';
      END;)
      ...) AS give_me_all`
    

    See how bad it looks? Better learn to write your own function 🙂

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

Sidebar

Related Questions

i have a question how to use an alias from a select query: $timecheck
I have a small sql question for you. I have two queries: SELECT tbl_CostPrevisions.Month,
hopefully a pretty simple question this time. I have a Select method in a
I have a question about a select box, I have a select box on
I have a question, regarding how the select text box is supposed to perform
I have a question about fiscal date literals in the Force.com API ( http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_dateformats.htm
I have two model: class Questions(models.Model): question = models.TextField(verbose_name='Question') def get_answers(self): query = self.answers.select_related()
This is a real newbie question. I have simple app that selects a picture
I have question about sending emails from MVC3 application. I already read for exmple
I have question about how I can save the result of function I 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.