case Questions

9

Solved

I'm trying to solve #13 on http://www.sqlzoo.net/wiki/The_JOIN_operation "List every match with the goals scored by each team as shown. This will use "CASE WHEN" which has not been explained in an...
Pradeep asked 15/4, 2014 at 11:9

11

I am a newbie when it comes to JavaScript and it was my understanding that using one SWITCH/CASE statements is faster than a whole bunch of IF statements. However, I want to use a SWITCH/CASE sta...
Forage asked 10/2, 2012 at 21:36

8

Solved

Id like to know how I can covert a string into a pascal case string in javascript (& most probally regex). Conversion Examples: double-barrel = Double-Barrel DOUBLE-BARREL = Double-Barrel Do...
Burchell asked 1/11, 2010 at 11:46

2

I'm trying to use a formula to get a field populated with the word "false" in NetSuite, but currently when I use this I get nothing showing up. If I modify it slightly to say "null" or "blank" or l...
Whipping asked 19/9, 2013 at 4:27

2

Solved

I would like to write an SQL statement with a CASE WHEN clause that uses the LIKE operator but I am not sure how to properly format the statement. SELECT services.id, (CASE services.description...
Sweater asked 4/5, 2017 at 18:0

6

Solved

I am pretty new to SQL and hope someone here can help me with this. I have a stored procedure where I would like to pass a different value depending on whether a column contains a certain country...
Dethrone asked 7/5, 2014 at 9:26

11

I have a program which has the user inputs a list of names. I have a switch case going to a function which I would like to have the names print off in alphabetical order. public static void ordere...
Interrelate asked 18/2, 2013 at 21:33

3

Solved

I want to use match to determine an action to perform based on a class type. I cannot seem to figure out how to do it. I know their are other ways of achieving this, I would just like to know can i...
Gillmore asked 11/3, 2022 at 16:37

4

The man page says that case statements use "filename expansion pattern matching". I usually want to have short names for some parameters, so I go: case $1 in req|reqs|requirements) TASK="Function...
Clova asked 29/12, 2010 at 13:57

4

Solved

Is there anyone with experience in PHP & Laravel Eloquent who can help me resolve this statement? I'm trying to inject a CASE... WHEN.. END... inside a raw() method. It seemed like it was compl...
Timon asked 13/6, 2013 at 16:19

6

Solved

Ruby has a fairly powerful case..when..else construct for when you need to match criteria against a single variable. What is the "canonical" way to match criteria against multiple variables without...
Danseuse asked 1/2, 2011 at 3:16

3

Solved

I have started to learn Ruby. I have a small project to build a game and tried to create a function that receives user input and handles it accordingly. def Game.listener print "> " while li...
Yarkand asked 29/11, 2016 at 14:43

30

Solved

How do I perform an IF...THEN in an SQL SELECT statement? For example: SELECT IF(Obsolete = 'N' OR InStock = 'Y' ? 1 : 0) AS Saleable, * FROM Product
Callimachus asked 15/9, 2008 at 14:34

5

Solved

I found a link to have a 'switch' tag in Django templates, but I was wondering if this can be somehow achieved without it. Using only the stuff which comes with Django? Basically is there other way...
Longdistance asked 7/4, 2009 at 13:43

6

Solved

I'm working on an Android App where the user has different options for sorting the displayed data that comes from the database. Currently my orderBy string that I pass to Androids query() method lo...
Oby asked 23/6, 2010 at 20:51

17

I have a variable in a dataframe where one of the fields typically has 7-8 values. I want to collpase them 3 or 4 new categories within a new variable within the dataframe. What is the best approac...
Pileup asked 7/1, 2011 at 2:39

11

Solved

The following image is a part of Microsoft SQL Server 2008 R2 System Views. From the image we can see that the relationship between sys.partitions and sys.allocation_units depends on the value of s...
Werbel asked 21/4, 2012 at 6:33

14

Solved

I tried searching around, but I couldn't find anything that would help me out. I'm trying to do this in SQL: declare @locationType varchar(50); declare @locationID int; SELECT column1, column2 F...
Incommodity asked 15/10, 2008 at 21:4

14

I am working with a query which contains "CASE" statement within "WHERE" clause. But SQL Server 2008 is giving some errors while executing it. Can anyone please help me with the correct query? Here...
Goldsmith asked 9/1, 2012 at 7:36

2

Solved

I'm trying to join the NAME and PHOTO from USERS table to the TRANSACTIONS table based on who is the payer or payee. It keeps telling me can't find the table this -- What am I doing wrong? SELECT ...
Kannry asked 3/5, 2010 at 22:13

3

Solved

Supposing we have a field status (0 for disabled, 1 for enabled), and we need to get the literal values directly using MySQL, in other words: if we requested the query: select status from `<ta...
Lavinia asked 22/4, 2013 at 13:21

3

Solved

I have a column Color which contains Black, Red, NULL, WW, RR. I want a column which has if color black then 'B' if color red then 'r' if color is Null then 'Empty' for all other entries 'n/a' I'm...
Inceptive asked 27/1, 2017 at 20:55

5

Solved

Is there something like array of case statement and put it as single case statement into switch- suppose String[] statements={"height","HEIGHT"}; and then switch(code){ case statements: //co...
Foreword asked 1/7, 2015 at 12:48

3

Solved

I have something like (COMPLEX_EXPRESSION_N stands for a long subquery) select ID_Operation, FirstCheck = CASE WHEN (COMPLEX_EXPRESSION_1)= 0 then 0 else 1 end, SecondCheck = CASE WHEN (COMPLE...
Dessalines asked 26/4, 2011 at 12:57

8

Solved

I'm querying a database like so: SELECT DISTINCT CASE WHEN CreatedDate = '1900-01-01 00:00:00.000' THEN '' ELSE CreatedDate END AS CreatedDate FROM LitHoldDetails lhd.CreatedDate is a DateTime ...
Locomotion asked 21/3, 2013 at 17:35

© 2022 - 2024 — McMap. All rights reserved.