concat

Select without duplicate from a specific string/key

会有一股神秘感。 提交于 2019-12-11 16:48:50
问题 Thanks to @Ed Gibbs i managed to solve my first problem on this case (Select duplicate and keep the oldest (not based on ID)) I am now facing a new problem I can not solve. I have two tables, "domain" which is clear of duplicate and "email" which contains duplicate. In the first table i had a value called "creationdate" which i used as a filter. In the second table i don't have any filter but some informations could (i think) be used to act as a filter. Table domain : | domain | value 1 |

How to GROUP_CONCAT where there are null values in MYSQL?

送分小仙女□ 提交于 2019-12-11 15:08:33
问题 I have a long query that returns multiple values for a primary key (from a LEFT join). For example : (only showing two fields, but there about 10 fields) LotID Size 1 A 1 B 1 C 2 null 3 B 4 A 4 B When I use GROUP_CONACT, it returns as follows : LotID Size 1 A,B,C 3 B 4 A,B But what I actually want is : LotID Size 1 A,B,C 2 null 3 B 4 A,B I tried using GROUP_CONCAT(CONCAT_WS(',', IFNULL(Size,''))) AS Sizes, It returns : LotID Sizes 1 A,B,C,,, 3 B,, 4 A,B,, It does not return LotID=2, also

Character Limit On ConcatRelated() Function

限于喜欢 提交于 2019-12-11 15:04:44
问题 I have been using Allen Browne's ConcatRelated() function but am realizing with larger data sets the data is incomplete. Does this function have a character limit, and if it does - is there a different function /UDF that can achieve the same result? This is the function: - and link back to original thread http://allenbrowne.com/func-concat.html Public Function ConcatRelated(strField As String, _ strTable As String, _ Optional strWhere As String, _ Optional strOrderBy As String, _ Optional

Concat Excel Column Cell Strings per row with comma

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 12:50:03
问题 I have an excel file with some columns. I have been trying to merge the columns and keep the cell strings separated with a comma. So, I want a new table with the concat results per row : =CONCATENATE(A2,",",B2,",",C2,",",D2) =CONCATENATE(A3,",",B3,",",C3,",",D3) =CONCATENATE(A4,",",B4,",",C4,",",D4) I tried to use VBA but with no success : Sub sisk() Dim sisk As String For i = 2 To 4 sisk = CONCATENATE(Range(Cells(1, i).Value), Cells(1, 4).Value) Next i Worksheets("Sheet1").Cells(1, 6) = sisk

MySQL JSON_OBJECT() with some fields already containing JSON String

喜夏-厌秋 提交于 2019-12-11 08:06:11
问题 How to get a JSON_OBJECT() of 3 columns whose some contains already a JSON format string . Here is my example with info field that contains a json string, so all this object is escaped : SELECT T1.id, CONCAT( '{"elements": [', GROUP_CONCAT( JSON_OBJECT( 'type', T2.`type`, 'data', T2.`data`, 'info', T2.`info` <<-- JSON stored string in varchar(100) ) ), ']}' ) AS `elements`, FROM `table` T1 INNER JOIN `table2` T2 ON T1.`id` = T2.`fk_t1_id` GROUP BY T1.`id` Maybe, use the new storage functions

MySQL SELECT Conditional CONCAT

六眼飞鱼酱① 提交于 2019-12-11 07:06:08
问题 I have a database which basically holds addresses The table (tblAddress) looks like this... housename | housenumber | address1 | address2 | address3 | town | postcode Banana House | 29 | Acacia Road | Yellow Skin Way | | Nuttytown | W1 1MP When I search the database based on a postcode I want to be able to return and result like this... Banana House,29 Acacia Road,Yellow Skin Way,Nuttytown,W1 1MP So I need the housenumber concatenated with address1 IF address1 is populated. If not then concat

Concatenating strings in F# number of times

十年热恋 提交于 2019-12-11 06:56:31
问题 I'm trying to concatenate a string with a certain amount of times, but I feel like I've cheated a bit (or at least not actually understood how it's supposed to be done) by using a higher-order function: let repeat s n = String.replicate n s |> printfn "%s" repeat "a" 10 Obviously gives me "aaaaaaaaaa", but how could I do this without a higher-order function? I feel like it's a very simple problem but I can't seem to wrap my head around it, the F# syntax, or way of thinking, is still

Merge an array of arrays in AngularJS

大城市里の小女人 提交于 2019-12-11 05:39:18
问题 I have the following controller which was a result of another OP on Stack Overflow. var getData = function() { var swindon = $http.get('(url)/swi/10?expand=true'), paddington = $http.get('(url)/pad/10?expand=true'), reading = $http.get('(url)/rdg/10?expand=true'); $q.all([swindon,paddington,reading]).then(function(arrayOfResults) { $scope.listOfServices = arrayOfResults; console.log($scope.listOfServices); }); }; getData(); Which results in something like this What I would like to do NOW is

Shift ragged rows of Pandas DataFrame to clean data with partial string search

China☆狼群 提交于 2019-12-11 05:16:49
问题 After importing data from a .csv file, I have some data that looks similar to this (albeit order hundreds of columns and thousands of rows): 4 5 6 7 8 9 10 11 12 13 14 15 16 0 302255Z 09005KT 1 1/4SM BR CLR M00/M00 A3044 RMK AO2A SLP311 T10021002 $; 1 302232Z 08003KT 1 1/4 BR CLR M00/M00 A3044 RMK AO2A SLP310 $; NaN 2 302225Z 09005KT 1 1/2SM BR CLR M00/M00 A3044 RMK AO2A SLP309 $; NaN 3 302155Z 08003KT 2 1/2SM BR CLR M00/M00 A3043 RMK AO2A SLP306 T10001000 $; 4 302055Z 09004KT 3SM BR CLR 00

How do I add Columns to an ndarray?

匆匆过客 提交于 2019-12-11 04:02:48
问题 So I have the below code that reads a file and gives me an ndarray using genfromtxt: arr = np.genfromtxt(filename, delimiter=',', converters={'Date': make_date}, names=('Date', 'Name','Age'), dtype=None) Now, I wished to add another column to arr called "Marks". Could you please help me out as to how I can do this? 回答1: np.genfromtxt generates record array's. Columns cannot be concatenated to record array's in the usual numpy way. Use numpy.lib.recfunctions.append_fields : import numpy as np