case

Haskell - Non-exhaustive patterns in case

做~自己de王妃 提交于 2019-12-25 02:17:03
问题 I have got the following code: F (S core ps) = FAll core [] ps where FAll core acc ((name, (pc : pcs)) : ps) = case F' (pc : pcs) (readC pc core) core of Nothing -> if (length pcs) /= 0 then FAll core ((name, pcs) : acc) ps else FAll core acc ps Just (core', [pc']) -> let pc'' = pc' `mod` coresize pcs' = pcs ++ [pc''] in FAll core' ((name, pcs') : acc) ps stepAll core acc [] = S core (reverse acc) It compiles fine but when I run the program it gives the following error: Melon.hs:(172,10)-(182

MSSQL Case When Statement Error

筅森魡賤 提交于 2019-12-25 00:42:49
问题 I'm working on trigger in MSSQL and i got this error message: Msg 512, Level 16, State 1, Procedure TirregerUpdate, Line 11 [Batch Start Line 0] Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated. Also these are my sql codes: Declare @NAME varchar(255) = 'ONE'; Declare @MKOD varchar(255); Declare @OMKOD varchar(255); DECLARE @STATUS BIT = 0; IF @STATUS = 1

Select Statement has Case that provies select value - SQL Server

て烟熏妆下的殇ゞ 提交于 2019-12-24 20:58:36
问题 I want to select UserType, UserID, FirstName, LastName, UserName from Users table. if PhotoURL is available from Photos table, I select. If record does not exists (UserType - admin only has record in Photos table), I should send spaces. The query is below. If you think of better query, please suggest. Select UserType, UserID, FirstName, LastName, UserName, CASE WHEN EXISTS( SELECT PhotoURL FROM Photos WHERE Photos.UserID = Users.UserID AND UserType = 'admin' AND Photos.PhotoNum = 1 ) THEN (

Loop through components and return in switch case (React.js)

半城伤御伤魂 提交于 2019-12-24 18:48:37
问题 Brief description So thanks to the svg-to-react-cli script I have 73 components for my icons. Now, if I want to call these icons, I can individually call each one I want to use. But this is not what I want. What I want is to call only one component where I add a 'name' value to. e.g.: < Icon name='Name of one of the 73 components I wish to call' /> My question How do I loop through multiple components inside a directory, and return them inside a switch case? This is how all my 73 components

Case Statements using variables not working

浪尽此生 提交于 2019-12-24 17:12:01
问题 EDIT: Made the query much simpler, same problem. I have basically two statements that select whether a person is deceased using a given account ID and filing period. When inputting an account with joint account holders, both queries (pr and jo) return values and the correct indicator shown in the case statement. When the second query returns no values (because there is no joint account holder to be indicated alive or deceased) then the case statement doesn't seem to work and returns no value.

linq to sql case query

蹲街弑〆低调 提交于 2019-12-24 16:07:57
问题 Im having problems building a query with the linq to sql data query expression in c#. What I'm trying to ultimately do is based on this pseudo-code expression. public IQueryable<CTest> searchRecords(string category, string searchString, DateTime startDate, DateTime endDate, int searchType, int searchType2) { //-Search All Records //-From the information table //-By the category column containing a specific search //-Also by // ~if both a startDate and endDate are entered (not (0000,00,00) OR

Oracle SQL count() per hour

你离开我真会死。 提交于 2019-12-24 15:33:34
问题 I have a query that shows the amount of shipments per hour, per carrier. I have it cased by hour, but it is showing zero's until the previous hour is complete before reporting data for next hour. Essentially, would like to read left to right, and have NULL if carrier didn't have shipment during that hour. Code: select router_destination_code, count(case when to_char(app_last_updated_date_utc, 'HH24') = '00' then router_destination_code else NULL end) as "Hour 1", count(case when to_char(app

select rows where same column values start with string, 2 questions

放肆的年华 提交于 2019-12-24 11:37:57
问题 I'm trying to get multiple sums of rows, each sum has a matching column string value, and all the values have a matching 4 character prefix, but it's not working and I could use some help. Also, would CASE be a more or less costly query on the db? Started with this: $sql = "SELECT col1 FROM table WHERE substr(col1,1,5)='$string'"; $query = mysqli_query($con, $sql); $row = mysqli_fetch_array($query,MYSQLI_ASSOC); $results = $row['col1']; $sum1 = count(array_keys($results,'string1')); $sum2 =

Using case in a sql select statement

守給你的承諾、 提交于 2019-12-24 10:35:43
问题 Consider a table with a column amount, Amount -1235.235 1356.45 -133.25 4565.50 5023 -8791.25 I want to my result pane to be like this, Debit Credit 0 -1235.235 1356.45 0 0 -133.25 Here is my stored procedure, USE [HotelBI_CustomDB] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[SP_GetJVReport]( @p_FromDate datetime, @p_ToDate datetime ) AS BEGIN select jv.AccountNo,jv.AccountNoTitle,(select JV_GroupsHead.GroupTitle from JV_GroupsHead where JV_GroupsHead.Id=jv

SQL where clause with case statement

夙愿已清 提交于 2019-12-24 09:29:43
问题 I have a problem with SQL that I have not yet found a solution to, what im trying to do is a where clause for a procedure where a userID variable can contain either a valid userID or -1 to indicate all users. However im stuck at this part of the where clause: AND usertable.userid = CASE WHEN @user = -1 THEN ELSE @user END I'm not sure how to process the -1 to say select all users Thanks 回答1: Perhaps the following would work: SELECT whatever FROM wherever WHERE something = somethingelse AND