The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
15 views

MySQL Case always executes the same [duplicate]

What I want to do is to set DATE_REACT a value when the first condition is satisfied, and a different value when the first condition is not satisfied. The problem is that the first condition is ...
0
votes
2answers
27 views

MySQL Case problem

I am trying to run a SQL code (I use MySQL). What I want to do is to set DATE_REACT a value when the first condition is satisfied, and a different value when the first condition is not satisfied. The ...
-1
votes
1answer
34 views

How do I select data with a case statement and group by?

I'm trying to manipulate data a little by using a case statement but can't seem to figure it out. Stops -------------------- 1Stop 1-Stop 1 stop 1 Stop 1stop 1 Stop 2-Stop Im trying to come up ...
0
votes
2answers
28 views

Update a date_modified MySQL Record Field ONLY when other fields have changed using CASE statement not working?

I have asked my question on Stackoverflow but have not really gotten any answers so I am trying over here now. I have the MySQL query that is ran in a PHP script below. What it does is Inserts a new ...
2
votes
3answers
237 views

Using expressions in the SELECT list to thin down a CASE statement

I have a query I'm working through rewriting - it has a huge bunch of case statements in the select list that all basically look like this: select Column1 = case when (Something = 2) and ...
0
votes
1answer
38 views

CASE conditions in SELECT statement [closed]

I have the following SELECT statement: SELECT expt_id, iso_stain, test_stain, stain_type CASE WHEN stain_type = 'Blue' THEN iso_stain = 'NA' CASE WHEN statin_type = 'Hematoxylin' THEN ...
0
votes
1answer
74 views

Case always returns null?

I have a subquery that gets the DATEDIFF of two dates. However the first case always returns null yet the actual sub query returns dates?! CASE WHEN [date1] > [date2] THEN ...
0
votes
0answers
22 views

Does SQL Server always parsing case switch in same order [duplicate]

Does sql CASE switch statement always processing (parsing) expressions in same order as it was written. If I write select case when 'a'<>'b' then 'a is ...
1
vote
1answer
715 views

Stored Procedure to evaluate column if condition is true execute another stored procedure

I have a stored procedure that executes with Windows task manager and I want to add a condition statement that executes another stored procedure if the condition is true. I was thinking a case ...
0
votes
1answer
36 views

Replace query result with case/when failing

Using MS SQL, I like to replace the information in the OEM_Description column when the column Item translation (IT).Description is NULL and when the language setting of the customer C.[Language Code] ...
0
votes
1answer
94 views

SQL Case Sensitive Query

I have two databases which return different results based on the case of the query. On the first database I run the query FROM [Temp].[Team].[CLASS] WHERE [TABLE_NAME] like '%Link%' and on ...
0
votes
0answers
54 views

How to write query using case statement

I have two mysql tables then i need to write a query to do the following I'm trying to achieve this by following query but i don't know how to complete this query. can someone help me on this ...
2
votes
0answers
547 views

Postgres Case statement not return else value in this query

I'm creating a SQL query with a some nested queries and I'm trying to use the CASE statement but it is behaving weirdly. I've been at it for at least 6 hours without any luck... This is my query at ...
0
votes
3answers
1k views

Running an “ORDER BY CASE” query on MySQL view breaks it afterwards

Whenever I create a MySQL view and then run a query ordering the results with ORDER BY CASE WHEN (...), the view becomes unusable. The newly created view works properly and all SQL is correct. This ...
0
votes
2answers
191 views

CASE Statement - 1st case is being ignored

I have a table (usr_t_user_reg) in which I register all the users of the database. Now I want to create a view (usr_v_user_not_reg) which shows me all the users that I haven't registered yet or users ...
-1
votes
1answer
76 views

Problems working with decode function when there is more then one expression

I am using Oracle 11g. I have these two tables: Table acct: acctnbr || Name || Mailing address 000001 || Slater || 000002 || Baker || Alt 000003 || Parke || Table addruse: ...
2
votes
1answer
1k views

ORDER BY items must appear in the select list […]

Using Microsoft SQL Server 2008, I get the following error. Msg 104, Level 16, State 1, Line 43 ORDER BY items must appear in the select list if the statement contains a UNION, INTERSECT or ...
3
votes
3answers
3k views

Return multiple rows from matching on multiple CASE matches?

I want to add a column to my query which will specify one or more categories a row matches. I want to take this: +--------------+---------------+ Row | Product | Quantity_Sold | ...
1
vote
2answers
563 views

Foreign key with multiple references

I have the following three tables in mysql database named "THE_COLLEGE" mysql> desc students; +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | ...
1
vote
2answers
239 views

Oracle Case when problem

I Have a table like fallowing work_id group effort ----------- ----- -------- 1 A 10 1 B 5 2 A 7 2 ...
1
vote
2answers
486 views

Way to update many (>3000) records with unique data, using a character limited web form

Okay, as you can probably tell from the last part of the title, this is a non-ideal situation. I'm using a piece of industry-specific web-interface software that I guarantee no one has ever heard of, ...
3
votes
2answers
7k views

CASE ORDER BY with multiple columns, and different sort options

I am attempting to use a T-SQL CASE ORDER BY in a stored procedure where I am passed @OrderBy parameter as a TINYINT. @Orderby = 1 Then Date column should be ASC @Orderby = 2 Then Date column ...
1
vote
1answer
233 views

Is my case statement broken by the use of outer apply?

I'm struggling with a case statement not working. Simple enough I need to supply a value of 0 where the question marks are. I have several other case statements which handle separate columns, but this ...
4
votes
3answers
37k views

Oracle SQL - CASE in a WHERE clause

Is it possible to somehow do this? WITH T1 AS ( SELECT 1 AS SEQ, 'NOTHING 1' AS SOME_TYPE FROM DUAL UNION ALL SELECT 2 AS SEQ, 'NOTHING 2' AS SOME_TYPE FROM DUAL UNION ALL SELECT 3 AS SEQ, ...