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

  • Home
  • SEARCH
  • 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 9056891
In Process

The Archive Base Latest Questions

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

i have an sql case statement like this select Distinct y.SupplierID,y.Name,y.AddWho , StatusDesc=CASE when

  • 0

i have an sql case statement like this

select Distinct y.SupplierID,y.Name,y.AddWho , 
        "StatusDesc=CASE when  y.status='N' then 'NEW' " & _
        "when y.status='B' then 'BLACKLISTED'" & _
        "when y.status='Q' then 'QUALIFIED'" & _
        "when y.status='R' then 'REJECTED' end , " & _
        "FlowStatusDesc = CASE when  y.flowstatus='RC' then 'UNDER REVIEW'" & _
        "when y.flowstatus='PE' then 'POTENTIAL EXCLUSIVE'" & _
        "when y.flowstatus='PO' then 'POTENTIAL ORDINARY' ELSE '' end," & _
        "OrderNo=case when y.status='N' and flowstatus='' then '1'" & _
        "when y.status='N' and y.flowstatus<>'' then '2'    " & _
        "when y.status='R' and y.flowstatus='' then '3'" & _
        "when y.status='R' and y.flowstatus<>'' then '4'" & _
        "when y.status='Q' and y.flowstatus='' then '5'" & _
        "when y.status='Q' and y.flowstatus<>'' then '6'" & _
        "when y.status='B' and y.flowstatus=''  then '7'" & _
        "when y.status='B' and y.flowstatus<>'' then '8' else '9' end " & _
        "from AP_Supplier y" & _
        " left outer join SC_User u on y.addwho=u.userid " & _
        "left outer join SC_Company co on co.companycode=u.companycode " & _
        "where flowstatus is not null " & _
        "group by y.SupplierID,y.name,y.status,y.flowstatus,y.addwho " & _
        "order by orderno"

how if can i load all the case statements condition like “new”, “qualified’, “registered” and the flowstatuses into a combobox on vb.net? can you give me an example? i’ve tried doing this for quite some time.thanks.

  • 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-16T14:18:57+00:00Added an answer on June 16, 2026 at 2:18 pm

    There are a lot of ways to do so, the first one is to populate the combobox from a list. In this case you should have a class, something like:

    public class Status(){
        public string Symbol { get; set; } // or Id
        public string Name { get; set; }
    }
    

    then a list of the statuses you have:

    var ds = new List<Status>(){
        new Status { Symbol = "N", Name = "New" },
        new Status { Symbol = "Q", Name = "Qualified" },
        .... 
    };
    

    Then you can easily populate the combox from this list using the two properties:

    • ValueMember.
    • DisplayMember.

    like so:

    YourcomboboxName.DataSource = ds;
    YourcomboboxName.ValueMember = "Symbol";
    YourcomboboxName.DisplayMember = "Name";
    

    The second way to do so, is to have a table or a temp table, contains these list of values like so:

    CREATE TABLE Statuses(StatusId INT, 
                          StatusSymbol VARCHAR(2), 
                          StatusName VARCHAR(20));
    
    INSERT INTO Statuses(StatusId, StatusSymbol, STatusName) VALUES
                        (1, 'N' , 'NEW'),
                        (2, 'B' , 'BLACKLISTED'),
                        (3, 'Q' , 'QUALIFIED'),
                        (4, 'R' , 'REJECTED'),
                        (5, 'UR', 'UNDER REVIEW'),
                        (6, 'PE', 'POTENTIAL EXCLUSIVE'),
                        (7, 'PO', 'POTENTIAL ORDINARY');
    

    Then you can use it the same way before using a data source that reads from this table and populate it. But this solution will make your query easier. You can JOIN with this table like so:

    SELECT DISTINCT 
      y.SupplierID,
      y.Name,
      y.AddWho,
      StatusDesc = s.STatusName,
      FlowStatusDesc = CASE WHEN ... END
      orderno = CASE WHEN ...
    FROM AP_Supplier y
    INNER JOIN statuses   s ON y.status       = s.StatusSymbol
    LEFT JOIN SC_User     u ON y.addwho       = u.userid
    LEFT JOIN SC_Company co ON co.companycode = u.companycode 
    WHERE flowstatus IS NOT NULL
    GROUP BY y.SupplierID,
             y.name,
             y.status,
             y.flowstatus,
             y.addwho
    ORDER BY orderno;
    

    Note that: Your table this way, needs to be refactored if possible, it would be better to get rid of these statuses names and have a new table Statuses with the id as a foreign key in the second table.

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

Sidebar

Related Questions

I have a select statement like this: SELECT ColumnA, CASE ColumnB = 'England' THEN
I have a SQL statement that is something like this SELECT t1.* CASE WHEN
I have the following SQL snippet within a select statement: CASE WHEN wot.id LIKE
I have this SQL query select case when AllowanceId is null then 2 else
I have a case statement which looks like this SELECT Location, CASE WHEN id
I have this select Case SQL statement which compute the totalvolume of a given
I have the following SQL statement SELECT c.CorpSystemID, c.SystemName , case when a.TaskItemID is
I would like to have an UPDATE statement like this: SELECT * FROM Employee
I have a SQL statement, select ColumnName from Table And I get this result,
I would love to have a t-sql statement like the following... SELECT [field] FROM

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.