The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
29 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
62 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
39 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
293 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
465 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
150 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
64 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
471 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 ...
2
votes
3answers
467 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
164 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
119 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
323 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
5k 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
155 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
29k 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, ...