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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:57:25+00:00 2026-06-03T20:57:25+00:00

Is it possible to use the result from a command on another command in

  • 0

Is it possible to use the result from a command on another command in Crystal Reports?

As an example, I have a command

SELECT foo FROM bar WHERE foo2 IN (list)

saved as command_1
Now I want

SELECT xfoo FROM xbar WHERE xfoo2 IN (command_1.foo)

In a simple case I realise I could just combine them to

SELECT xfoo FROM xbar WHERE xfoo2 IN (SELECT foo FROM bar WHERE foo2 IN (list))

but in my real world case that gives me errors due to too many nested SELECTs.

My real world example if someone wants to give a specific and not just a general answer:

Existing command saved as pnr:

SELECT DISTINCT rem.pop_pid
FROM a_remiss rem
INNER JOIN a_bestall best ON rem.arem_id = best.arem_id
JOIN a_prov prov ON best.apro_id = prov.apro_id
WHERE prov.pro_provdat >= {ts '2006-01-01 00:00:00'}
AND prov.pro_provdat <= {ts '2011-12-31 23:59:59'}
AND best.ana_analyskod IN ('PKREAT', 'PKREA', 'PKREAN')
AND (
rem.pop_pid LIKE '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] 1[89]'
OR rem.pop_pid LIKE '[01][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] 20'
)

Wanted additional new command:

SELECT arem_id, apro_id, ana_analyskod
FROM a_bestall
WHERE ana_analyskod IN('ABSBIK', 'BCRPS')
AND arem_id IN (
SELECT arem_id
FROM a_remiss
WHERE rem_ank_dttm >= {ts '2006-01-01 00:00:00'}
AND rem_ank_dttm <= {ts '2012-01-31 23:59:59'}
AND pop_pid IN pnr.pop_pid
)

EDIT: Fixed a code error that now makes the nested SELECTs work, but it would still be nice to be able to nest commands.

  • 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-03T20:57:27+00:00Added an answer on June 3, 2026 at 8:57 pm

    The short answer is no, Commands can not be nested.

    If you can get the syntax to work in a query tool, it should work in a Command.

    If you are still getting syntax errors, consider using a different database driver. I’ve noticed that the ‘native’ drivers do a better job than ODBC.

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

Sidebar

Related Questions

Is it possible, to use a dynamic value inside a SELECT FROM sql command?
is it possible to use prepared statements with the SELECT command? I wrote in
Is it possible to use custom method In query for example: var result =
Is it possible use mod_rewrite to resolve addresses hosted on another server? Say I
Is it possible to use the 10g collect command as an analytical function by
I want to know how to limit the MySQL result. I can use select
We have a command line application that could benefit from a GUI. We want
i have some complex select and result need to place in the table. I
I try to modify /foo/bar/dir to \/foo\/bar\/dir by ruby gsub command. I test it
Is it possible use a MySQL query to perform this kind of check? If

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.