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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:25:21+00:00 2026-05-28T19:25:21+00:00

I want to combine to tables: the sql is: select name, extract(DAY from fechaNacimiento)

  • 0

I want to combine to tables: the sql is:

select name, extract(DAY from fechaNacimiento) from alumno
union
select name,extract(DAY from fechaNacimiento) from asesor

Is it possible to use that query in a dsql() or dq() statement?

  • 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-28T19:25:22+00:00Added an answer on May 28, 2026 at 7:25 pm

    I am author of Agile Toolkit and UnionModel implementation is now available as a separate module for Agile Data.

    http://www.agiletoolkit.org/data/extensions/report

    With the extension, assuming you have models for “Alumno” and “Asesor” for which fields name/day are defined to produce above queries, you can construct a Union Model based on domain logic:

    $union = new \atk4\report\UnionModel($db);
    $union->addNestedModel(new Model_Alumno());
    $union->addNestedModel(new Model_Asesor());
    $union->addField('name');
    $union->addField('day');
    

    Resulting model will be read-only but can be fully used anywhere, will support grouping, conditions, limits and will query only fields necessary.


    Solution without using “Reporting Extension” would involve aligning queries from nested models manually and putting them inside Expression:

    $expr = new \atk4\dsql\Expression(
        "select ... from ([] union [])",
        [
            $m1->action('select', [$fields]), 
            $m2->action('select', [$fields]),
        ]
    );
    

    Support for versions prior to 4.4 are now considered obsolete.

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

Sidebar

Related Questions

I want to combine the following queries into a single query: SELECT val FROM
I want to create view that combine data from two tables, sample data in
I want to combine three tables - date, lead and click - in a
I'm trying to combine to two tables, and I want the smallest id where
I want to combine these two queries into one: mysql_query(INSERT INTO categories (name, parent)
I have 2 separate arrays being pulled from MYSQL database, and want to combine
I have to queries: select id, name, num from pending id, name, num 1,
Suppose that I want to create an SQL SELECT statement dynamically with reflection on
How do you combine multiple select count(*) from different table into one return? I
I want to extract text from a column using regular expressions in Oracle 11g.

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.