Click here to Skip to main content
15,907,497 members
Home / Discussions / Database
   

Database

 
GeneralRe: Copy 84 million rows from one table to another table. Pin
vanikanc30-Jan-12 4:50
vanikanc30-Jan-12 4:50 
AnswerRe: Copy 84 million rows from one table to another table. Pin
RK KL30-Jan-12 5:06
RK KL30-Jan-12 5:06 
AnswerRe: Copy 84 million rows from one table to another table. Pin
Eddy Vluggen30-Jan-12 5:34
professionalEddy Vluggen30-Jan-12 5:34 
GeneralRe: Copy 84 million rows from one table to another table. Pin
vanikanc30-Jan-12 5:39
vanikanc30-Jan-12 5:39 
AnswerRe: Copy 84 million rows from one table to another table. Pin
Eddy Vluggen30-Jan-12 7:01
professionalEddy Vluggen30-Jan-12 7:01 
AnswerRe: Copy 84 million rows from one table to another table. Pin
jschell30-Jan-12 9:12
jschell30-Jan-12 9:12 
AnswerRe: Copy 84 million rows from one table to another table. Pin
PIEBALDconsult31-Jan-12 2:59
mvePIEBALDconsult31-Jan-12 2:59 
Question[ANSWERED] Group_Concat and using a query result in the where clause Pin
Dwayner7929-Jan-12 7:35
Dwayner7929-Jan-12 7:35 
Two seperate questions, but apply to the same query, so here goes:

SQL
SELECT ProdID, ProdTitle, CONCAT(Contacts.ContactFName, " ", Contacts.ContactLName) AS Author FROM Products LEFT OUTER JOIN ...


This works and returns each item with multiple "author" like:
ProdID     Prod Title         Author
123         Title 1          John Doe
123         Title 1          Jane Doe
465         Title 2          John Doe
456         Title 2          Jane Smith


But what I want is:
ProdID     Prod Title         Authors
123         Title 1      John Doe, Jane Doe
465         Title 2      John Doe, Jane Smith


So I add a Group Concat to the Author and i get one line and a BLOB in the AUTHORS
SQL
SELECT ProdID, ProdTitle, GROUP_CONCAT(CONCAT(Contacts.ContactFName, " ", Contacts.ContactLName)) AS Authors FROM Products LEFT OUTER JOIN...


Question #1 is why does this not work.

Question #2 is how can I use the resulting "Authors" in the WHERE clause against a search string.


Edit 1 ref Question 2: I realize I can redo the concat in the where clause, and that is a fine answer if there are no other options, I just thought you could use the newly created "column" in the where clause directly. Seems cleaner then doing the code twice.
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW


modified 29-Jan-12 19:09pm.

AnswerRe: Group_Concat and using a query result in the where clause Pin
Jörgen Andersson29-Jan-12 8:35
professionalJörgen Andersson29-Jan-12 8:35 
GeneralRe: Group_Concat and using a query result in the where clause Pin
Dwayner7929-Jan-12 11:24
Dwayner7929-Jan-12 11:24 
GeneralRe: Group_Concat and using a query result in the where clause Pin
Dwayner7929-Jan-12 13:01
Dwayner7929-Jan-12 13:01 
QuestionURL rewriting using urlrewriternet not working Pin
Timothy OBrien28-Jan-12 12:17
Timothy OBrien28-Jan-12 12:17 
AnswerRe: URL rewriting using urlrewriternet not working Pin
Timothy OBrien28-Jan-12 12:19
Timothy OBrien28-Jan-12 12:19 
GeneralRe: URL rewriting using urlrewriternet not working Pin
Jörgen Andersson29-Jan-12 8:07
professionalJörgen Andersson29-Jan-12 8:07 
QuestionHow to take database backup on online server ? Pin
infobeena28-Jan-12 1:49
infobeena28-Jan-12 1:49 
AnswerRe: How to take database backup on online server ? Pin
R. Giskard Reventlov28-Jan-12 5:02
R. Giskard Reventlov28-Jan-12 5:02 
AnswerRe: How to take database backup on online server ? Pin
Eddy Vluggen28-Jan-12 5:25
professionalEddy Vluggen28-Jan-12 5:25 
QuestionCreate Database Ms SQl server Pin
Mangore7527-Jan-12 10:42
Mangore7527-Jan-12 10:42 
AnswerRe: Create Database Ms SQl server Pin
Eddy Vluggen27-Jan-12 23:51
professionalEddy Vluggen27-Jan-12 23:51 
GeneralRe: Create Database Ms SQl server Pin
Mangore7528-Jan-12 3:25
Mangore7528-Jan-12 3:25 
GeneralRe: Create Database Ms SQl server Pin
jschell28-Jan-12 4:47
jschell28-Jan-12 4:47 
GeneralRe: Create Database Ms SQl server Pin
Mangore7528-Jan-12 4:57
Mangore7528-Jan-12 4:57 
GeneralRe: Create Database Ms SQl server Pin
jschell28-Jan-12 13:58
jschell28-Jan-12 13:58 
AnswerRe: Create Database Ms SQl server Pin
Eddy Vluggen29-Jan-12 0:16
professionalEddy Vluggen29-Jan-12 0:16 
GeneralRe: Create Database Ms SQl server Pin
Eddy Vluggen28-Jan-12 5:22
professionalEddy Vluggen28-Jan-12 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.