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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:46:10+00:00 2026-05-30T10:46:10+00:00

Hey guys so my query isn’t returning my union results when I specify my

  • 0

Hey guys so my query isn’t returning my union results when I specify my main selects column names, aka

SELECT inspection_number, region, report_date, 
inspection_type AS type, customer, customer_number, shipper, po
FROM reports
JOIN (
    (

        SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
        FROM `berries`
    )
    UNION (

        SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
        FROM `melons`
    )
    UNION (

        SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
        FROM `citrus`
    )
    UNION (

        SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
        FROM `table_grapes`
    )
    UNION (

        SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
        FROM `tree_fruit`
    )
    UNION (

        SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
        FROM `lot`
    )
) fruits ON inspection_number = fruits.report_key
WHERE fruits.status = '0' OR fruits.status = '1'
ORDER BY report_date DESC

Does not return key, report_key, shipper, po, commodity, label, or status

Strangely running

SELECT *
inspection_type AS type, customer, customer_number, shipper, po
FROM reports
JOIN ( -- etc.....

Will? How can I fix this?

  • 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-30T10:46:11+00:00Added an answer on May 30, 2026 at 10:46 am

    The fruits derived table does have the columns mentioned but in your main select you don’t mention any of them; you only mention the columns inspection_number, region, report_date, inspection_type from reports – therefore it only shows them.

    If you want to include the fruits columns, you need to specify them in your main select statement

    i.e. something like:

    SELECT inspection_number, region, report_date, 
    inspection_type, key, report_key, shipper, po, commodity, label, status AS type, customer, customer_number, shipper, po, key, report_key, shipper, po, commodity, label, status
    FROM reports
    JOIN (
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I am getting this exception when trying to run the query Column
Hey guys I have a query that selects data and organizes but not in
Hey guys, trying to optimize this query to solve a duplicate user issue: SELECT
Hey guys, I have this query. SELECT COUNT(purchase_log.id), purchase_log.date_purchased, purchase_log.total_cost, purchase_log.payment_status, cart_contents.product_name, members.first_name, members.last_name,
Hey guys I have a query that currently finds the latest comment for each
hey guys I just started trying to convert my query structure to PDO and
hey guys, just having a bit of difficulty with a query, i'm trying to
Hey guys, I created a list for fixtures. $result = mysql_query(SELECT date FROM .TBL_FIXTURES.
Hey guys I just noticed that my join statement here SELECT * FROM reports
Hey guys I managed to get a text input and select box to updated

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.