FAQ Database Discussion Community


MySQL split on semicolon in a column to form a new row for each split

mysql,split,concat,group-concat
So I've been given legacy mysql db with data that looks like this: DATE | DATA 2015-04-27 | sample; sample2; sample3 2015-04-28 | sample1; sample4 I'm looking to create a new table that would store date/data pairs like this. DATE | DATA 2015-04-27 | sample 2015-04-27 | sample2 2015-04-27 |...

Solr is not concatenating words in a query

solr,word,concat
I am having trouble with Solr. I want it to concatenate words in the search query. For example, I want to be able to search "data link" and have it hit on a document that contains "datalink" (Google does this -- so why is this so difficult with Solr?). Here...

Mysql query CONCAT change the output

php,mysql,sql,concat
I have the following query: mysql> select (select m.delay from messages m order by message_id desc limit 1) as Delay, s.min_delay, s.max_delay from statistics s order by s.date_hour desc limit 1; +-------+-----------+-----------+ | Delay | min_delay | max_delay | +-------+-----------+-----------+ | 10 | 7.00 | 12.00 | +-------+-----------+-----------+ 1 row...

Move given row to end of DataFrame

python,pandas,dataframes,concat
I would like to take a given row from a DataFrame and prepend or append to the same DataFrame. My code below does just that, but I'm not sure if I'm doing it the right way or if there is an easier, better, faster way? testdf = df.copy() #get row...

JavaScript function to automatically count consecutive letters in a string

javascript,arrays,string,counter,concat
I am attempting (unsuccessfully) to write JavaScript function LetterCount to count the consecutive letters in a string (and not the total number). Ideally: LetterCount("eeeeeoooohhoooee") = [["e", 5],["o",3],["h",2],["o",3],["e",2]] The following code attempts to count the number of consecutive letters in a string only when I already know what they are: function...

MySQL - Add text or texts to a row if conditions are satisfied

mysql,concat,string-concatenation
Sorry if the question is basic, I am learning MySQL. Let's say I have a table like this: +---+---+-----+ |A |B |Con | +---+---+-----+ |3 |3 | | |2 |3 | | |3 |2 | | |2 |2 | | +---+---+-----+ I want to update the Con column based on...

Concat Columns produces NAN even though axis is the same for all datasets

python,pandas,dataframes,concat
I am trying to concat columns from multiple dataframes. `AUD = OHLC_AUDUSD['bid']['close'];` `AUD = AUD.dropna()` `CAD = OHLC_USDCAD['bid']['close'];` `CAD = CAD.dropna()` `print AUD` symbol timestamp AUDUSD 2015-01-05 0.8096 2015-01-06 0.8077 2015-01-07 0.8074 2015-01-08 0.8112 2015-01-09 0.8200 Name: close, dtype: float64 `print CAD` symbol timestamp USDCAD 2015-01-05 1.1756 2015-01-06 1.1838 2015-01-07...

How to get mysql Group_Concat to work with additional CONCAT information?

php,mysql,concat,group-concat
I'm working on a web app with mysql involving a user role table where permission levels are stored as well as role ids and associated to usernames and their ids (redundancy to continue supporting legacy code). I want to be able to display every user's role as a comma seperated...

SELECT DISTINCT and CONCAT don't return value correcly

mysql,sql,select,distinct,concat
I have a DataBase with this values: CREATE TABLE test ( Id CHAR (50), Time TIMESTAMP , Value CHAR (50) ); INSERT INTO test VALUES ('JOE', '2015-06-05 15:36:21', "ZONE1"); INSERT INTO test VALUES ('ANNA', '2015-06-05 14:27:35', "ZONE2"); INSERT INTO test VALUES ('JOE','2015-06-05 16:27:36', "ZONE2"); INSERT INTO test VALUES ('ANNA', '2015-06-05...

Query With CONCAT and LOOP using SELECT

mysql,loops,concat
I got this kind of column: ------------------ |reference_number| ------------------ |1 | |12 | |123 | |1234 | |12345 | |123456 | |1234567 | |12345678 | |123456789 | |1234567890 | ------------------ I want to achieve this kind of output using mysql query: ------------------ |reference_number| ------------------ |0000000001 | |0000000012 | |0000000123 |...

How to access String in Closure

javascript,jquery,jquery-mobile,closures,concat
by triggering xyEvent I want to concatenate a string. But myClosure() is always empty. Why? Thanks for help. first.js: $(document).ready(function () { $("#...").on("tap", function () { myClosure(new Item()); }); ... } second.js var string; xyEvent { string = "hello" + myClosure(); // here is the problem }); var myClosure =...

Nested SQL with Coalesced data part of an update statement

sql-server,join,sql-update,concat,coalesce
I have the following set up create table #work ( customer_no int, attended_conf varchar(100) -- ADDED LR 6/16/15 ) The #work table is filled - customer_no is filled, attend_conf is null until a later update statement. What I would like to do is update the attended_conf field with the concatenated...

Oracle SQL - Concat rows with specific properties

sql,oracle,row,concat
I wrote a SQL - Statement to export the results to an excel sheet for analytics. At the moment I have the problem: Some data which are split in 2 rows but need it as 1 row. Reason for that is one column, with different values. I explain the structure:...

Using Like and Concat with Char Type

mysql,char,like,concat,varchar
I have a MySQL statement that is trying to find if the ID of a row (CHAR(36)) is inside of a string. My statement is : select * from `options` where concat('%',`OptionID`,'%') like '{\"4d519a3d-c99b-11e4-8eda-b8ca3a83b4c8\":\"62.50\"}'; But this fails and doesn't return anything, while this select * from `options` where `OptionID`='4d519a3d-c99b-11e4-8eda-b8ca3a83b4c8'; works...

Concatenate Object values

javascript,arrays,object,concat,value
I have a JavaScript Object and I'm sure the value of any key is an array (even empty in some case): {key1:["a","b","c"],key2:["d","e","f"],key3:...} Aside from using Underscore, is there any way to concatenate all the values of this Object (and create a new array)? At the moment I get the keys...

mySQL prepend text to column if not null

mysql,sql,sql-update,concat
I just did a mass import of 200,000 items into the database, but forgot to add the directories under the image column. Is there a way to mass update the column and prepend the images directory? This is what I've been trying, but it doesn't work: UPDATE wp_store_locator SET sl_image...

Concatenate a number to url everytime I click on the button?

javascript,string,numbers,concatenation,concat
How do I concatenate a number to string everytime I click on the button? If I log cConcate variable you will see that the first value is right but on subsequent clicks the url refuses to update. var tNumber = 1; var sSting = "http://www.test.com/"; var cConcate = sSting +...

group_concat in mysql with “case when ” conditions

mysql,case,concat,group-concat,.when
I wrote sql code in mysql environment to concat the data . But, I couldn't get the correct result , and I am confusing about what is wrong with my sql code. my sql code is as follows: SELECT case when cc.complex_check_id = cmt.comp_o_id then cc.status cstatus,sgk.status sgstatus,cc.NAME complex_check_name,cc.min min_flag,cmt.comp_t_name...

Get values of mySQL rows in PHP and echo multiple values of certain rows

php,mysql,concatenation,concat
the title is a little vague on what I want to do so I'll do the explaining here. I have two tables that I get information from, the Book table and Inventory table. I get the Book Title, Author Name and ISBN from Book table, and I concatenate the Quantity...

CASE Using CASE Statements to check for Null or Empty value

sql,oracle,case,concat
I need to write a DB function to concatenate 4 values. These values can be empty or null. How can I concatenate only the values that are not empty or null? Pseudo Code CASE WHEN #p1 IS NULL THEN '' ELSE #p1 END || CASE WHEN #p2 IS NULL THEN...

SELECT CONCAT alternative in PostgreSQL

mysql,sql,postgresql,concat
How can I write the following MySQL query in PostgreSQL syntax: SELECT CONCAT(REPEAT("   ", (COUNT(parent.name) - 1)), cat.name) AS name Thanks in advance!...

mysql select concat of one-to-many matches on left join

mysql,concat,group-concat
If have a table roots like: id | root and another extensions like id | order | extensionpre | extensionval | extensionpost How can I build a view like id | root | group_concat(concat(extensionpre, extensionval, extensionpost)) Right now I'm trying: SELECT id, root, GROUP_CONCAT (concat(extensionpre, extensionval, extensionpost)) FROM roots AS...

Javascript: Why array variable assignment is behaving differently inside and outside this function?

javascript,arrays,concat,reduce
For the life of me, I just can't figure out what I'm doing wrong here. I'm trying to use both the reduce and concat array methods to take all of the values of a 2d array and combine them into a single value (basically condense them into a single array...

Concatenate appended strings and remove last character

javascript,jquery,string,concat
I have a list that I want to retrieve all items and append them to a paragraph. I am currently successful in doing so but it doesn't append into one string (you need to check the DOM to see it), but several instead. I have tried using .concat() to retrieve...

SQL Concat or LIKE with wildcard?

sql,like,concat
The table includes two columns where one enumerates countries (name) and another capitals (capital). I need to find the country which name is included in its capital. For example country is Mexico and its capital is Mexico City. How is it possible to do using Concat or Like? Have tried...

concatenate strings and coalesce

sql-server,tsql,string-concatenation,concat
I have a query that selects rows from three different tables: TableA, TableB and TableC. One field of my query has to be the concatenation of the field Name in each table like the following alias: SELECT A.Name, B.Name, C.Name, CONCAT(A.Name, ' / ', B.Name, ' / ', C.Name) AS...

How to use Group_Concat() to concat in MySql

mysql,concat,group-concat
I have table structure like this- Code Codelang Name 14 de David 14 en Michel 14 es John I want to show this table as- Code Name 14 [:de]David[:en]Michel[:es]John[:] Is it possible to do this using Group_Concat() or is there any other way to do this.?...

Select Concat Substring and Replace in MySQL

mysql,string,replace,concat
I have a .sql file that needs all the extra characters removed and just the text left. So anything inside the " ". An example of the TEXT field in the column is a:1:{i:0;s:9:"test word here";} a:1:{i:0;s:11:"test words here too";} So I would want the words. test word here. and...

Mysqli add numeric value with concat?

php,mysql,variables,mysqli,concat
I need to update a the employee hours column with the current numeric value that is already existed in the database. $mysqli->query("UPDATE `".MYDATABASE."`.`".MYTABLE."` SET employeeHours='".$employeeHours."' WHERE sessionID='".session_id()."'"); This like is working properly but needless to say that it's overwriting the old value. My goal is to add the current $employeeHours...

Why is concat reformatting my headings?

csv,pandas,append,concat
I have sorted a CSV file as I want it and appended a column to sort my data properly. However, in using concat (I think this is where the issue is, anyway) The output CSV file has been changed to (0L, 'HeadingTitle'). I just want it to be HeadingTitle. import...

How to dynamically concat a block of byte stream from http response in javascript?

java,javascript,http,httprequest,concat
So, I want to send a stream of bytes to the browser(for example a pdf) so he can show it to the user. if (bytesToRead == -1) { bytesToRead = (int)fullPathFile.length();} byte[] buffer = new byte[bytesToRead]; int bytesRead = -1; if((inputFileInputStream != null) && ((bytesRead = inputFileInputStream.read(buffer)) != -1)){ if...

Adding a formatted date on to the end of a concat function

excel,vba,date,format,concat
I'm currently looking to add an updating date in a DD/MM format to the end of a string of text currently generated by an existing macro. Sub Nomediatidy() Dim w1 As Worksheet Dim w2 As Worksheet Dim result As Range Dim FirstRow As Integer Set w1 = Worksheets("Sheet1") Set w2...

Attempting to create a SUM with a CONCAT in the range, google sheets says no

excel,sum,formula,concat
I was wondering if you could help me with a request. I used a custom script that dynamically creates one half of a cell reference, and I use a ROW formula to calculate the other half of the reference. The problem is, I'm trying to use that generated reference in...

mysql pivot table with concat AND pivot counting of selected rows

mysql,pivot,concat
I have the following mysql-table cars layout BRAND | TYPE | COLOR ----------------------- bmw | e30 | red bmw | e90 | blue bmw | e12 | red audi | a3 | green bmw | e90 | red audi | tt | blue bmw | e12 | blue audi |...

gulp concat after sass

sass,gulp,concat,gulp-concat
I would like to take the sass output and concat it to another css regular file. example: animate.css app.scss return gulp.src('app.scss') .pipe(sass({ errLogToConsole: true })) .pipe(concat(['animate.css', OUTPUT_OF_THE_SASS_ABOVE])) .pipe(gulp.dest(paths.public+'css/')) .pipe(rename({ extname: '.min.css' })) .pipe(gulp.dest('css/')) .on('end', done); any ideas how to do it? ******* IDEA maybe is it possible to generate the...

puppet concat::fragment not inserting content in vhost

apache2,puppet,concat,vhosts
So I have a vhost config in my puppet manifest file apache::vhost { 'site.dev': port => '80', docroot => '/home/vagrant/projects/Personal/php/site/public', serveradmin => '[email protected]', options => ['Indexes','FollowSymLinks','MultiViews'], setenv => ["APP_ENV dev"], override => ['All'], } Now I want to add these options EnableSendfile Off EnableMMAP Off I googled and found that...

Haskell append to a list conditionally

list,haskell,concat
I have 2 lists which I am trying to fill will items. While reading from stdin, depending on the value of one of the things read, I want to append to a different list. Example, import Control.Monad(replicateM) main = do n <- getLine let l1 = [], l2 = []...

Concat string as `“@gmail” to Usernames and ignore some lines

mysql,concat,ignore
I have a table Table1 with following fields Username NumberID CodeUser Company Username NumberID CodeUser Company user1 12453 245 G user2 25145T Y user3 1845Z /500 G user4 65421 3452 Y user5 13254 /076 Y I would have a query result which will show lines user1 and user4 Meaning to...