* * *

Author Topic: Running two select statements  (Read 1205 times)


  • New member
  • *
  • Posts: 18
Running two select statements
« on: March 09, 2017, 06:30:44 pm »
Hey there,

Is there a way two run multiple select statements to select a value from two different tables, using one SQLQuery, or do I need two??


Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 406
    • Lebeau Software
Re: Running two select statements
« Reply #1 on: March 09, 2017, 08:33:40 pm »
Do the two tables have values that are related to each other for cross-referencing?  If so, you can use a JOIN in a SELECT statement's FROM clause to join the two tables together on those values.

Otherwise, you can use a UNION to join the results of separate SELECT statements.  Or use a sub-query SELECT statement inside of another SELECT statement.

Can you show an example of what you are trying to select exactly?
« Last Edit: March 09, 2017, 08:38:20 pm by Remy Lebeau »
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)



Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus