1
  • Case Statements SQL

    I'm running a query that returns a specific status code. However, within my query that specific status doesn't always exist and I get a null value. I would like to return another status when that is the case. I can't seem to get the case statement to work.

    Wilso01115 pointsBadges:
  • ms sql query problem with a case statement

    [strong]This code works: SELECT     passengers.*, passship.passship_name AS name, passship.passship_speed AS speed, passship.passship_size AS cargo, hyperjump.hops AS hops, ROUND((passengers.pass_engers * passengers.pass_price) / (hyperjump.hops * passship.passship_speed), 0) AS ptprofit...

    Rinkratt20 pointsBadges:
  • Making two records into one

    I was not sure on how to word the title of my questions, so it is better if I simply give you my query and result: SELECT DISTINCT PJ.EMPL_NUM, (CASE WHEN PAY_TYPE = 1 THEN RATE ELSE 0 END) AS REG_RATE, (CASE WHEN PAY_TYPE = 3 THEN RATE ELSE 0 END) AS OVR_RATE FROM dbo.tblPayrollFlashJobDetail AS...

    Fscopel15 pointsBadges:
  • empty fields in a query

    I have a column with answers that people responded to different questions about themseleves. I have another column with the question id that the answer corresponds to. i want to display the answers in separate columns based on which question it corresponds to. Each column should be filled with the...

    Bananahead60 pointsBadges:
  • Oracle SQL question

    I want to create a SQL script in Oracle that will run one of two possible SQL scripts based on what the user enters in the Parameter request. Since I'm unable to use IIF and If Then like I can in SQL Server, is there another way to do this? I have tried using case statements but Oracle doesn't like...

    Wanderer95775 pointsBadges:
  • Nested Case statement in Oracle BI

    I am trying to create a nested case statement in Oracle BI (9.0.4) the statement works when I do it in Oracle SQL*Plus but will not let me keep the whole script in the Calculation.What do I need to doo to have this work in Oracle BI? The statement is as follows: select emp_name, (CASE WHEN...

    Nanapap5 pointsBadges:
  • Order by using case statement SRS 2000

    I am using a case statement to order data on a SRS report, when the statement is ran, it returns the correct order, but when I save the RDL and preview it, it returns to ascending order. How do I correct this?

    Wi sundevil5 pointsBadges:
  • Switch/Case statment in access

    how i can use Switch/Case Satatment in Mic. Access 2003, am working on database as follow: Field Name: Directions in this field i need to write codes like: TAm Field Name: Translation here i need to read TAm as T=Take, Am= Morning. the problem i have more than 200 codes, which they have to be...

    Darkblue4615 pointsBadges:
  • How Do I assign a value if a value in the field is empty

    In my script (that is not working yet) I want to make sure if "full_value" (a field) is empty in a particular record then the value zero will be inserted. This is working in Access, but I'm trying to rebuild the query in SQL. Thank you. SELECT DISTINCT oas_balance.cmpcode, oas_balance.el1,...

    Ilfoprog50 pointsBadges:
  • I want to return multiple value in the THEN clause of CASE statement

    I want to return multiple value in the THEN clause of CASE statement. SELECT c.company_code, c.com_inactive_flag, e.emp_no FROM company c, employees e WHERE c.com_code = e.com_code AND e.emp_status in ( (CASE c.com_inactive_flag WHEN 'N' THEN 'A' WHEN 'Y' THEN 'B,C' END) If the flag is N all those...

    Balcode5 pointsBadges:
  • Which Is More Optimized

    Which Conditional Statemnt Is More Efficient in VB.NET 2005 IF ELSE OR Switch Case ?

    AnjanaDurga70 pointsBadges:
  • CASE sintaxis error in SELECT

    In the middle of a large storage procedure I have a working SELECT 01 (see below) which at a couple of points uses CASE statement. I need to expand the most inner CASE to get SQL Server check for several values instead of one. Currently CASE I am talking about looks like (it is in the middle of...

    Jzurbo775 pointsBadges:
  • Using Case Statement Inside SQL Join

    Hi, I am trying to convert dynamic sql into static sql due to permission issue, I faced a challange when i am trying to convert this part of code given below -- join to ADDR_DETAIL SET @join_sql = 'inner join ADDR_DETAIL on ADDR_DETAIL.GRP_CONTACT_ID = pm.GRP_CONTACT_ID AND ' IF (@ChannelEntity =...

    Bmdayal5 pointsBadges:
  • ms sql case statement

    I have written a case statement in MS SQL that is returning a single phone number for a single id. This is valid as the database contains multiple phone numbers attached to the same id number, with differentiation based on phone type. Once I have found the prefered phone number, I do not want to...

    Espqueen5 pointsBadges:
  • How to use subselect in a case statement

    Getting error... "Token EXISTS was not valid...." on case statement... ,case when g.GFGSTS = '2' and not exists (select a.GFTSEQ from GFTP010 a where a.GFCSQ# = g.GFCSQ# and a.GFGSTS = '3' ) then count(*) end as Void#

    Qpgmr5 pointsBadges:
1

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following