concatenation

Show a one to many relationship as 2 columns - 1 unique row (ID & comma separated list)

被刻印的时光 ゝ 提交于 2020-01-08 13:22:12
问题 I need something similar to these 2 SO questions, but using Informix SQL syntax. Concatenate several fields into one with SQL SQL Help: Select statement Concatenate a One to Many relationship My data coming in looks like this: id codes 63592 PELL 58640 SUBL 58640 USBL 73571 PELL 73571 USBL 73571 SUBL I want to see it come back like this: id codes 63592 PELL 58640 SUBL, USBL 73571 PELL, USBL, SUBL See also group_concat() in Informix. 回答1: I believe that the answer you need is a user-defined

Safe way to concat two strings in C

爷,独闯天下 提交于 2020-01-07 09:46:11
问题 I have the following code that concats two strings: char *getConcatString(char *str1, char *str2) { char *finalString = malloc(1 + strlen(str1) + strlen(str2)); // Needs to be freed by the user after use if(finalString == NULL) return NULL; strcpy(finalString, str1); strcat(finalString, str2); return finalString; } Is there a more safe way to do this? Like for ex. strncat and strncpy? Thanks 回答1: Is there a more safe way to do this? The only thing I would do with the function is changing its

How to concatenate two DNAStringSet sequences per sample in R?

拥有回忆 提交于 2020-01-07 02:03:57
问题 I have two Large DNAStringSet objects, where each of them contain 2805 entries and each of them has length of 201. I want to simply combine them, so to have 2805 entries because each of them are this size, but I want to have one object, combination of both. I tried to do this s12 <- c(unlist(s1), unlist(s2)) But that created single Large DNAString object with 1127610 elements, and this is not what I want. I simply want to combine them per sample. EDIT: Each entry in my DNASTringSet objects

How to concatenate in SQL Server

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 14:52:44
问题 My database doesn't have a specific column so I created a column in my query by switch. What I need is to concatenate this column with another column in the database: select certificateDuration , 'DurationType' = case when certificateDurationType = 0 then 'Day' when certificateDurationType = 1 then 'Month' when certificateDurationType = 2 then 'Year' end from Scientific_Certification 回答1: To concatenate strings in SQL Server you can simply use the + operator. Note that if one of the

FROM keyword not found where expected, text selection Oracle SQL

巧了我就是萌 提交于 2020-01-06 04:36:10
问题 I want to produce a table which contains substrings and IDs of another table, where the substrings occur. See question Concatenate values. create table table_expressions ( A clob ); insert all into table_expressions (a) values ('atveroeosipsum') into table_expressions (a) values ('test') into table_expressions (a) values ('stetclitakasd') into table_expressions (a) values ('noseatakimata') into table_expressions (a) values ('loremipsumdolor') into table_expressions (a) values (

Concatenating variable names in Python [duplicate]

心不动则不痛 提交于 2020-01-06 02:07:43
问题 This question already has answers here : How to get the value of a variable given its name in a string? [duplicate] (4 answers) Closed 3 years ago . I need to check variables looking like this: if name1 != "": (do something) Where the number right after "name" is incremented between 1 and 10. Do I need to write the test ten times or is there a way (without using an array or a dict) to "concatenate", so to speak, variable names? I'm thinking about something like this: for i in range(10): if

Concatenating variable names in Python [duplicate]

ⅰ亾dé卋堺 提交于 2020-01-06 02:07:02
问题 This question already has answers here : How to get the value of a variable given its name in a string? [duplicate] (4 answers) Closed 3 years ago . I need to check variables looking like this: if name1 != "": (do something) Where the number right after "name" is incremented between 1 and 10. Do I need to write the test ten times or is there a way (without using an array or a dict) to "concatenate", so to speak, variable names? I'm thinking about something like this: for i in range(10): if

Concatenation of AWK array variables - unexpected behaviour

安稳与你 提交于 2020-01-05 12:09:24
问题 Input file steve,apples steve,oranges john,pears john,oranges mary,bananas steve,plums mary,nactarines I want to get output like this: steve:apples,oranges,plums john:pears,oranges mary:bananas,nectarines Here is the one liner I have been trying to get to work: awk -F, '{if(a[$1])a[$1]=a[$1]","$2; else a[$1]=$2;}END{for (i in a)print i ":" a[i];}' OFS=, inputfile The output it gives is ,orangesrs ,plumsesples ,nactariness It would appear that the string concatenation a[$1]=a[$1]","$2 is

Bash variable concatenation fails inside loop

一笑奈何 提交于 2020-01-05 08:52:53
问题 Given the following statements: ac_reg_ids="-1" #Starting value (mysql) | while read ac_reg_id; do echo "$ac_reg_id" #variable is a result of a mysql query. Echoes a number. ac_reg_ids="$ac_reg_ids, $ac_reg_id" #concatenate a comma and $ac_reg_id, fails. done echo "ac_reg_ids: $ac_reg_ids" #echoes -1 Now according to this answer: https://stackoverflow.com/a/4181721/1313143 Concatenation should work. Why doesn't it, though? What's different within the loop? Just in case it could matter: > bash

Excel - Counting no of items in a different sheet between a certain range matching specific criteria

孤街醉人 提交于 2020-01-05 08:36:14
问题 I have been building up an excel sheet to interrogate a data set and produce a set of metrics. I'm aiming to make the process as expandable as possible. In the links are pictures of a simple mock up data set to illustrate what I'm trying to achieve, it contains a metrics sheet where I want to display the information and the data set sheet: and the The aim is to have the highlighted cell (D6) display the number of items in "Sheet2" that meet the criteria of Item Status "Open". I have managed