Click here to Skip to main content
15,895,142 members
Home / Discussions / Database
   

Database

 
QuestionSubquery returned more than 1 value Pin
Sam Heller2-Jul-07 5:47
Sam Heller2-Jul-07 5:47 
AnswerRe: Subquery returned more than 1 value Pin
jonathan152-Jul-07 6:56
jonathan152-Jul-07 6:56 
GeneralRe: Subquery returned more than 1 value Pin
Sam Heller2-Jul-07 7:00
Sam Heller2-Jul-07 7:00 
GeneralRe: Subquery returned more than 1 value Pin
jonathan152-Jul-07 7:09
jonathan152-Jul-07 7:09 
GeneralRe: Subquery returned more than 1 value Pin
Sam Heller2-Jul-07 9:53
Sam Heller2-Jul-07 9:53 
AnswerRe: Subquery returned more than 1 value [modified] Pin
Harini N K3-Jul-07 0:58
Harini N K3-Jul-07 0:58 
GeneralRe: Subquery returned more than 1 value Pin
Praveen02928-Aug-07 0:29
Praveen02928-Aug-07 0:29 
AnswerRe: Subquery returned more than 1 value Pin
DQNOK3-Jul-07 5:05
professionalDQNOK3-Jul-07 5:05 
Harini is right I believe.

Something like:

SELECT DISTINCT
   IH.InvoiceDate    AS HistoryDate
 , 'Part of Invoice' AS HistoryType
 , SI.SiteName       AS HistoryBranch
 , ('Invoice Number - ' + IH.InvoiceNumber + ' - ' + C.CustomerForeName + ' ' + C.CustomerSurname) AS HistoryReference
 , getInvoicePhoneIMEIs(IH.InvoiceID) AS HistoryIMEIs
FROM         tblInvoiceHeader IH
  INNER JOIN tblInvoiceItems  II ON II.InvoiceID = IH.InvoiceID
  INNER JOIN tblSites         SI ON IH.SiteID    = SI.SiteID
  INNER JOIN tblStaff         ST ON IH.StaffID   = ST.StaffID
  LEFT  JOIN tblCustomers      C ON IH.CustomerID= C.CustomerID
WHERE II.StockID = '1750'
  AND IH.InvoiceDate >= 'January 1, 2007'
  AND IH.InvoiceDate <= 'July 2, 2007'
  AND IH.SiteID = '10'
  AND IH.InvoiceProForma = 0

where getInvoicePhoneIMEIs(IH.InvoiceID) uses a cursor based on your subselect to build a string.
http://www.sqlteam.com/article/using-coalesce-to-build-comma-delimited-string[^]
Be sure to include the DISTINCT keyword or you'll get a result row for every InvoicePhoneIMEI value.

David
Questionsecure DB Pin
merwa2-Jul-07 0:21
merwa2-Jul-07 0:21 
AnswerRe: secure DB Pin
leckey2-Jul-07 11:48
leckey2-Jul-07 11:48 
AnswerRe: secure DB Pin
Mike Dimmick2-Jul-07 12:28
Mike Dimmick2-Jul-07 12:28 
QuestionMSAccess Pin
nitin32-Jul-07 0:19
nitin32-Jul-07 0:19 
AnswerRe: MSAccess Pin
martin_hughes2-Jul-07 0:29
martin_hughes2-Jul-07 0:29 
GeneralRe: MSAccess Pin
nitin32-Jul-07 0:37
nitin32-Jul-07 0:37 
AnswerRe: MSAccess Pin
Rahul.Goel2-Jul-07 21:41
Rahul.Goel2-Jul-07 21:41 
QuestionTime Out Error Pin
sajmera2-Jul-07 0:11
sajmera2-Jul-07 0:11 
AnswerRe: Time Out Error Pin
kubben2-Jul-07 2:18
kubben2-Jul-07 2:18 
Questiondisplay 2 table records in a single asp page Pin
dheema2-Jul-07 0:02
dheema2-Jul-07 0:02 
AnswerRe: display 2 table records in a single asp page Pin
gauthee10-Jul-07 21:52
gauthee10-Jul-07 21:52 
QuestionWant to add column in table in dynamic query Pin
Khawar Abbas12-Jul-07 0:01
Khawar Abbas12-Jul-07 0:01 
AnswerRe: Want to add column in table in dynamic query Pin
andyharman2-Jul-07 0:31
professionalandyharman2-Jul-07 0:31 
QuestionReading/Writing text files in Oracle Pin
Mangilipelli1-Jul-07 23:32
Mangilipelli1-Jul-07 23:32 
AnswerRe: Reading/Writing text files in Oracle Pin
andyharman2-Jul-07 0:30
professionalandyharman2-Jul-07 0:30 
GeneralRe: Reading/Writing text files in Oracle Pin
Mangilipelli2-Jul-07 4:33
Mangilipelli2-Jul-07 4:33 
Questionsql server2000 Pin
ahmedalisha1-Jul-07 21:15
ahmedalisha1-Jul-07 21:15 

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.