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

  • SEARCH
  • Home
  • 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 8348653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:45:28+00:00 2026-06-09T07:45:28+00:00

Here is a sample of my query: SELECT … TRIM(eml.fxeml1) as Email Address FROM

  • 0

Here is a sample of my query:

SELECT ...
TRIM(eml.fxeml1) as "Email Address"
FROM pfship

LEFT JOIN mstfxem fax
ON fax.fxco=pfship.cshco AND fax.fxdiv=pfship.cshdiv AND fax.fxsold=pfship.cshsld
AND fax.fxtype='C' AND TRIM(fax.fxfax1) <> '' AND fax.fxdept LIKE '*F%'

LEFT JOIN mstfxem eml
ON eml.fxco=pfship.cshco AND eml.fxdiv=pfship.cshdiv AND eml.fxsold=pfship.cshsld
AND eml.fxtype='C' AND TRIM(eml.fxeml1) <> '' AND eml.fxdept LIKE '*E%'

WHERE ((pfship.cshco || '/' || pfship.cshdiv) = ?)
  AND (? = '*ALL' OR CAST(cshsld AS CHAR(15)) = ?) 
  AND ...
  ORDER BY TRIM(cshnme)

This query should return 9 records. When I remove:

LEFT JOIN mstfxem fax
ON fax.fxco=pfship.cshco AND fax.fxdiv=pfship.cshdiv AND fax.fxsold=pfship.cshsld
AND fax.fxtype='C' AND TRIM(fax.fxfax1) <> '' AND fax.fxdept LIKE '*F%'

LEFT JOIN mstfxem eml
ON eml.fxco=pfship.cshco AND eml.fxdiv=pfship.cshdiv AND eml.fxsold=pfship.cshsld
AND eml.fxtype='C' AND TRIM(eml.fxeml1) <> '' AND eml.fxdept LIKE '*E%'

I get 9 records, but with it I get 360 records. What is wrong with my join?

Thanks

I think the problem is that 1 person can have many emails or faxes, how do I group the results into 1 string per record so I end up with only 9 records?

  • 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-09T07:45:29+00:00Added an answer on June 9, 2026 at 7:45 am

    Nothing is wrong with your join, you have a one to many relationship between the tables.

    Depending on what you need there are several techniques. First is the derived table. Write a query to pick out only one record from the one to many table (your requirements should specify which record to pick). Join to that instead. OR you may be able to put further conditions on the left join to get only one record. Some examples of these techniques:

    select t1.field1, t2.email
    from table1 t1 
    join (select myid, max(email) as email from table2 group by myid) t2 
      on t1.myid = t2.myid
    

    Or

    select t1.field1, t2.email
    from table1 t1 
    Left join from table2  t2 
      on t1.myid = t2.myid and t2.active = 1
    

    Or if you want all of the emails in a comma delimited list, that code is database specific and you would need to let us know which database backend you are using.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my sample query: SELECT userid,count(*) FROM hits GROUP BY userid My table
Here is sample query SELECT name, sum(SELECT id FROM mytable WHERE cond='1' and cond2='2')
Here is a sample query: UPDATE `table1` SET `table1`.`field1` = (SELECT COUNT(*) FROM `table2`
I have a sample query as shown below: SELECT * FROM [#temp1] UNION SELECT
Here is a sample access query which I have(query ref/name - abovequery) select column_date,
This is a sample query select * from tablename where tableid in (<sub query>);
I have a query - SELECT PK1 FROM users ; I also have a
Here is a simple scenario I am contemplating. I have a query that is
Here's sample model classes, which being use with Entity Framework Code First: public class
Here is sample data <table class=sparql border=1> <tr> <th>abstract</th></tr> <tr> <td> Cologne is Germany&#39;s

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.