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.
[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 FROM passengers INNER JOIN hyperjump ON passengers.pass_terms = hyperjump.startsystem AND passengers.pass_system = hyperjump.endsystem CROSS JOIN passship WHERE (passship.passship_name = ‘Rinkratt’) ORDER BY ptprofit DESC, [...]
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 [...]
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 answers to the specific 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 [...]
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 [...]
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 [...]
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, oas_balance.el2, oas_balance.full_value, CASE WHEN balcode [...]
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 employees will be retrieved whoe has status [...]
Which Conditional Statemnt Is More Efficient in VB.NET 2005 IF ELSE OR Switch Case ?
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 [...]
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?
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 = '') OR (@ChannelEntity IS NULL) [...]
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 [...]
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#





