concatenation

SQL Help: Select statement Concatenate a One to Many relationship

冷暖自知 提交于 2019-11-30 16:29:11
For example I have two tables. The first table is student while the second table are the courses that the a student is taking. How can I use a select statement so that I can see two columns student and courses so that the courses are separated by commas. Thanks. Assuming you're using SQL Server 2005: This should do what you're after - obviously replace fields as you need: For demo purposes, consider the following two table structures: Students( STU_PKEY Int Identity(1,1) Constraint PK_Students_StuPKey Primary Key, STU_NAME nvarchar(64) ) Courses( CRS_PKEY Int Identity(1, 1) Constraint PK

How to concatenate multiple Python source files into a single file?

早过忘川 提交于 2019-11-30 16:28:02
(Assume that: application start-up time is absolutely critical; my application is started a lot; my application runs in an environment in which importing is slower than usual; many files need to be imported; and compilation to .pyc files is not available.) I would like to concatenate all the Python source files that define a collection of modules into a single new Python source file. I would like the result of importing the new file to be as if I imported one of the original files (which would then import some more of the original files, and so on). Is this possible? Here is a rough, manual

String concatenation into StringBuilder java

﹥>﹥吖頭↗ 提交于 2019-11-30 16:21:59
I have a legacy Java file which uses String concatenation to build huge String objects.Its a serious performance issue.Is there a method as such which does the following String test="I am a very bad programmer" +"to use concatenation" +"Instead of StringBuilder" +" or StringBuffer"; to StringBuilder strBuilder= new StringBuilder(); strBuilder.append("I am a bad programmer"); strBuilder.append("to use concatenation"); strBuilder.append("Instead of StringBuilder"); strBuilder.append(" or StringBuffer"); String str= strBuilder.toString(); basically I need a stub in java just to give a the String

String concatenation into StringBuilder java

半城伤御伤魂 提交于 2019-11-30 16:14:32
问题 I have a legacy Java file which uses String concatenation to build huge String objects.Its a serious performance issue.Is there a method as such which does the following String test="I am a very bad programmer" +"to use concatenation" +"Instead of StringBuilder" +" or StringBuffer"; to StringBuilder strBuilder= new StringBuilder(); strBuilder.append("I am a bad programmer"); strBuilder.append("to use concatenation"); strBuilder.append("Instead of StringBuilder"); strBuilder.append(" or

C++ Using stringstream after << as parameter

时光毁灭记忆、已成空白 提交于 2019-11-30 14:04:21
Is it possible to write a method that takes a stringstream and have it look something like this, void method(string str) void printStringStream( StringStream& ss) { method(ss.str()); } And can be called like this stringstream var; printStringStream( var << "Text" << intVar << "More text"<<floatvar); I looked up the << operator and it looks like it returns a ostream& object but I'm probably reading this wrong or just not implementing it right. Really all I want is a clean way to concatenate stuff together as a string and pass it to a function. The cleanest thing I could find was a stringstream

SQL using If Not Null on a Concatenation

随声附和 提交于 2019-11-30 12:35:53
If I have the table SELECT (Firstname || '-' || Middlename || '-' || Surname) AS example_column FROM example_table This will display Firstname-Middlename-Surname e.g. John--Smith Jane-Anne-Smith The second one (Jane’s) displays correct, however since John doesn’t have a middlename, I want it to ignore the second dash. How could I put a sort of IF Middlename = NULL statement in so that it would just display John-Smith Andrew Wolfe Here would be my suggestions: PostgreSQL and other SQL databases where 'a' || NULL IS NULL , then use COALESCE : SELECT firstname || COALESCE('-' || middlename, '') |

I'm trying out Grunt and need a simple way to concatenate my modules

泪湿孤枕 提交于 2019-11-30 11:48:43
This is my first time using Grunt and I'd like to have it combine all my js modules, each of which is wrapped in an immediately executing function, containing a 'use strict' declaration and put them into one file, wrapped up in only one immediately executing function, with only one 'use strict' declaration. How is this normally done? I figured this would be a common use case? Perhaps I'm going about things the wrong way? Should I be using one of the module loading formats (i.e. commonjs, amd) All these files will always be loaded together in the browser, so I actually wouldn't mind removing

How to concatenate data from one field, in a comma-delimited list, in a many-to-many relationship in MySQL?

最后都变了- 提交于 2019-11-30 11:46:48
I have a many-to-many relationship between People and Departments since one person can be in many departments. People Departments ------ ----------- pID pName deptID deptName 1 James 1 Engineering 2 Mary 2 Research 3 Paul 3 Marketing 4 Communications People_Departments ------------------ pID deptID 1 1 1 2 2 2 2 4 3 1 3 2 3 3 What I want is this: pName deptName James Engineering, Research Mary Research, Communication Paul Engineering, Research, Marketing If I do plain LEFT JOINs on the tables using the SQL below, I will get several rows related to one person: SELECT people.pName, departments

Concatenating strings with `if` statements in JavaScript

你离开我真会死。 提交于 2019-11-30 10:54:22
I'm attempting to set up a script to concatenate some variables inside a string if they exist , in order to place the appropriate metadata tags into a rendered HTML document. My concatenation code is: data = "<html>\n<head>\n" + "</head>\n<body>\n\n" + paras.join("\n\n") + "\n\n</body>\n</html>"; I'm trying to add if statements like the following into it (between the first and second items): if (typeof metadata_title !== "undefined") { "<title>" + metadata_title + "</title>\n" } if (typeof metadata_author !== "undefined") { "<meta name=\"author\" content=\"" + metadata_author + "\"></meta>\n"

Can UIPinchGestureRecognizer and UIPanGestureRecognizer Be Merged?

Deadly 提交于 2019-11-30 09:45:06
I am struggling a bit trying to figure out if it is possible to create a single combined gesture recognizer that combines UIPinchGestureRecognizer with UIPanGestureRecognizer. I am using pan for view translation and pinch for view scaling. I am doing incremental matrix concatenation to derive a resultant final transformation matrix that is applied to the view. This matrix has both scale and translation. Using separate gesture recognizers leads to a jittery movement/scaling. Not what I want. Thus, I want to handle concatenation of scale and translation once within a single gesture. Can someone