Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8211581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:28:24+00:00 2026-06-07T10:28:24+00:00

I have a parent / child table as shown below with a one to

  • 0

I have a parent / child table as shown below with a one to many relationship on the EmailQueueAttachments table.

ERD

The parent table (EmailQueue) has one row and two related rows in the child table (EmailQueueAttachments) and after writing a simple join query I get the below results.

SELECT     EmailQueue.ID, EmailQueue.SenderAddress, EmailQueue.RecipientList, EmailQueue.CCList, EmailQueue.Subject, EmailQueue.Body, EmailQueue.BodyHTML, 
                      EmailQueue.DisclaimerFooter, EmailQueue.Sent, EmailQueue.SendError, EmailQueue.CreatedDate,EmailQueueAttachments.AttachmentPath
FROM         EmailQueue LEFT OUTER JOIN
                      EmailQueueAttachments ON EmailQueue.ID = EmailQueueAttachments.EmailQueueID
WHERE     (EmailQueue.Sent = 0) AND (EmailQueue.SendError = 0) AND (EmailQueue.BodyHTML IS NULL)

4   xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx NULL    xxxxxxx 0   0   10/07/2012 11:58    \\server\orange.png
4   xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx NULL    xxxxxxx 0   0   10/07/2012 11:58    \\server\pear.png

Is there a simple way to return one row with the AttachmentPath column from the child table as a csv or do I need to write a stored procedure and use temp tables to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:28:26+00:00Added an answer on June 7, 2026 at 10:28 am

    This should give you the paths in one column as a comma separated list.

    N.B. I did not test so there may be typos.

    SELECT  EmailQueue.ID, EmailQueue.SenderAddress, EmailQueue.RecipientList,
            EmailQueue.CCList, EmailQueue.Subject, EmailQueue.Body, EmailQueue.BodyHTML,
            EmailQueue.DisclaimerFooter, EmailQueue.Sent, EmailQueue.SendError, 
            EmailQueue.CreatedDate,
            substring((SELECT ( ', ' + EQA.AttachmentPath)
                               FROM EmailQueueAttachments EQA
                               WHERE EmailQueue.ID = EQA.EmailQueueID
                               FOR XML PATH( '' )
                              ), 3, 1000 ) as [Path List]
    FROM EmailQueue 
    WHERE   
         (EmailQueue.Sent = 0) AND (EmailQueue.SendError = 0) AND (EmailQueue.BodyHTML IS NULL)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables a parent and a child table. The child table has
I have two tables Loan(Parent Table) and Receipt(Child table)what i want to do is
I have a table with two child tables. For each record in the parent
I have multiple level parent-child tables(GrandParent, Parent and Child, all many to one relation,
Let's say I have a simple parent->child class structure as shown below Public Class
I have a parent/child database relationship between the table ACCOUNT and the table USER.
I have two tables, Parent and Child. The column Parent.favorite_child has a foreign key
I have two tables, one parent Point and one child PointValue, connected by a
I've got a dataset with two tables, a simple one to many parent child
If I have a parent table and a child table where there can be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.