Hi, 
I have the following sql statement where i'm trying to update multiple rows matching a select statement.
UPDATE Cars
SET engineSize = CASE specCode WHEN 1 THEN value ELSE engineSize END
FROM Cars
INNER JOIN CarSpecs ON CarsSpecs.carID = Cars.carID
My tables are as follows:
Cars
carID   engineSize ...
1       0
2       0
CarSp...
            
           
          
            
            does anybody know how to do this syntax below in mysql?
without Stored Procedure
and in single query only
SELECT CASE
 WHEN COUNT(v.value) = 0 THEN (
  INSERT INTO tbl_v (fid, uid, VALUE)
  SELECT fid, 1 AS uid, 'xxxxxx' AS VALUE FROM tbl_f
  WHERE category = 'categoryname' AND NAME = 'somevalue'
 )WHEN v.value <> 'test' THEN (
  'u...
            
           
          
            
            In PHP I'd like to do this:  
switch (function_foo($bar,$bar2)) {
case $fu:
    *Do Stuff*
    break;
case $fubar:
    *Do Other Stuff*
    break;
}
Is this a terrible idea? Will it work?
...
            
           
          
            
            Is there a valid way to do the following in Haskell:
case n of
    0     -> doThis
    1     -> doThat
    2     -> doAnother
    3..99 -> doDefault
other than to have 97 lines of "doDefault" ?
...
            
           
          
            
            I have the following SQL code that runs against a Change Request database.  Each record has several columns that represent affected US regions.  If the change affects a region the value will be 1 otherwise NULL.
So I am adding the values in each column to determine if more than one region is affected, the answer will be greater than 1.
...
            
           
          
            
            is possible do a case in a group by?
 similar to this:
select * from table
    GROUP BY 
      CASE WHEN @Attivita=0 THEN (RANK() OVER (GROUP BY Nome,AccountID,Matricola DESC))   
     END
thanks
...
            
           
          
            
            Hello,
My source table looks like this
Id     StartDate
1      (null)
2      12/12/2009
3      10/10/2009
I want to create a select statement, that selects the above, but also has an additional column to display a varchar if the date is not null such as : 
Id     StartDate    StartDateStatus
1      (null)       Awaiting
2      12/12...
            
           
          
            
            I'm programming a simple text-based RPG using a switch statement for a game loop. The program works fine until I attempt to add another case statement, at which point it gives me the following three errors: "jump to case label" (error occurs at the line of the newly added case), and two "crosses initialization of 'ClassName *objectName'"...
            
           
          
            
            Hi
I'm writing a bash script which needs to convert a string to lowercase. The problem is I'm doing it on a mac so 'tr' is not available. How can I go about doing this on a mac?
The problem I'm trying to tackle is that my script needs to recognize an if an extension is a .gif or a .jpg - and I don't want to have to check for .jpeg, .jP...
            
           
          
            
            I'm trying to assign values contained in a lookup table to multiple variables by using a single SELECT having multiple CASE statements.
The table is a lookup table with two columns like so:
[GreekAlphabetastic]
  SystemID    Descriptor
  --------    ----------
  1           Alpha
  2           Beta
  3           Epsilon
This is my s...
            
           
          
            
            I have this function:
void ToUpper(char * S)
{
    while (*S!=0)
    {
       *S=(*S >= 'a' && *S <= 'z')?(*S-'a'+'A'):*S;
       S++;
    }
} 
What does it mean for *S != 0, should it be null instead?
...
            
           
          
            
            I have lists of data such as
a = [1,2,3,4]
b = ["a","b","c","d","e"]
c = ["001","002","003"]
And I want to create new another list that was mixed from all possible case of a,b,c like this
d = ["1a001","1a002","1a003",...,"4e003"]
Is there any module or method to generate d without write many for loop?
...
            
           
          
            
            What I am trying to do here is: IF the records in table todo as identified in $done have a value in the column recurinterval then THEN reset date_scheduled column ELSE just set status_id column to 6 for those records.
This is the error I get from mysql_error() ...
You have an error in your SQL syntax; check the manual that corresponds ...
            
           
          
            
            Hi there.
Im creating customizable product attributes in a web store - each attribute can have different type of data, each data type is stored in a separate column using corresponding mysql datatype.
I Have a query like:
SELECT
products.id AS id,
products.sku AS sku,
products.name AS name,
products.url_key AS url_key,
attributes.name...
            
           
          
            
            I guess there might be some overlapping with previous SO questions, but I could not find a Delphi-specific question on this topic.
Suppose that you want to check if an unsigned 32-bit integer variable "MyAction" is equal to any of the constants ACTION1, ACTION2, ..., ACTIONn, where n is - say 1000. I guess that, besides being more elega...
            
           
          
            
                SELECT `profiles`.* 
    FROM `profiles` 
    INNER JOIN `friendships` 
    ON `profiles`.id = `friendships`.(CASE WHEN friendships.profile_id = 1
    THEN`friend_id` ELSE `profile_id` END)
How can i make the inner join like profile.id = friendships.(here will select the one key that is needed) but it doesnt work. please help :P
i...
            
           
          
            
            Most systems will have a user-defined function (UDF) available. Some will not. i want to use the UDF if it's there:
SELECT 
    Users.*,
    dbo.UserGroupMembershipNames(Users.UserID) AS MemberOfGroupNames
FROM Users
Otherwise fallback to the acceptable alternative
SELECT
   Users.*,
   (SELECT TOP 1 thing FROM Something 
    WHERE S...
            
           
          
            
            Here is the pseudo-code for my inline query in my code:
select columnOne
from myTable
where columnOne = '#variableOne#'
  if len(variableTwo) gt 0
      and columnTwo = '#variableTwo#'
  end
I would like to move this into a stored procedure but am having trouble building the query correctly. I assume it would be something like
select...
            
           
          
            
            I am using FogBugz free hosting to manage my project bugs, I also have several customers I create custom software for, been using FogBugz to keep everything organized.
Question I have is, there are times where they send me an email with a bug, so I report it in my system and they create it as well, instead of having 2 cases of same bug,...
            
           
          
            
            Hi, 
When programming in VHDL, can you use a variable in a case statement? This variable will modified by one of the cases
i.e.
case task is
when 1 =>
when 2 => 
when number =>
is this OK?
...