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 6947761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:44:04+00:00 2026-05-27T13:44:04+00:00

I need to ‘manufacture’ records for a query, but at the same time, restrict

  • 0

I need to ‘manufacture’ records for a query, but at the same time, restrict the list of values that are returned from a ‘lookup’ table.

Is there a way to use ‘filter’ a CROSS JOIN without having to resort to using an in-line view?

This syntax works as expected (I get the desired results):

SELECT  E.ID,  
        M.VALUE,
        MT.ID, MT.NAME

FROM    ENCOUNTER E
CROSS JOIN (
      SELECT  ID, NAME
      FROM    MEASUREMENT_TYPE
      WHERE   ID IN ('6941','6946')
) MT
LEFT OUTER JOIN MEASURE M ON E.ID=M.ENCOUNTER_ID
        AND MT.ID=M.MEASURE_TYPE_ID

Unfortunately, if I use this approach, I need to use a Command object with Crystal Reports rather than its native ‘Visual Linking Expert’. Command objects irritate me.

Adding a filter to the WHERE clause results in an equal join, which is undesirable in this situation.

  • 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-05-27T13:44:04+00:00Added an answer on May 27, 2026 at 1:44 pm
    SELECT
      E.ID,  
      M.VALUE,
      MT.ID,
      MT.NAME
    FROM
      ENCOUNTER         AS E
    CROSS JOIN
      MEASUREMENT_TYPE  AS MT
    LEFT OUTER JOIN
      MEASURE           AS M
        ON  E.ID  = M.ENCOUNTER_ID
        AND MT.ID = M.MEASURE_TYPE_ID
    WHERE
      MT.ID IN ('6941','6946')
    

    In this case you can put the filter in the WHERE clause because it’s a LEFT JOIN and you’re filtering the left side of the query.

    If you were filtering the Measure table, the filter would have had to go in the LEFT JOIN‘s ON clause.

    An additional alternative is to INNER JOIN instead of CROSS JOIN and use the filter there. This is because the ON clause doesn’t actually need to reference both tables…

      ENCOUNTER         AS E
    INNER JOIN
      MEASUREMENT_TYPE  AS MT
        ON MT.ID IN ('6941','6946')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need to take a SELECT drop down list options and find if any of
need a little help with this one. I have a form that I am
Need your help with my PHP/MYSQL array. I have a php script that selects
Need help with an error message that I just can't figure out. I am
Need help for that. I have a tabbar with 2 views, A and B
Need to login and download xml file from the below url : http://www.radionyhetene.net/download/nyheter/mp3/nyheter.xml I
Need a little help from you guy's. I am making a check where element
Need help formatting a mySQL query string. The following query returns parse error, expecting
Need to get all direct nodes from DOM element and don't actually know, how
Need of time server services I am trying to build a web application in

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.