-1

enter image description here

My Union Select statement works, but the results are on top of each other.

SQL Statement:

SELECT Cust_ID, Cust_FirstName, Cust_LastName 

FROM kmsrutge_xoxoxo.Customers 

UNION 

SELECT Item_Type, Quantity, Total_Amount 

FROM kmsrutge_xoxoxo.Invoices  

WHERE Total_Amount >= '$5.00'
Al Fahad
  • 2,378
  • 5
  • 28
  • 37
  • 1
    What are you mixing column data types which are not the same? I don't see any clean way to alter your query to make the result sensible. – Tim Biegeleisen Nov 06 '18 at 14:02
  • 3
    What is the question? – Caleth Nov 06 '18 at 14:02
  • I need the bottom column data to the right with the table names. – katelynn767 Nov 06 '18 at 14:32
  • "I need the bottom column data to the right with the table names" I have a feeling you want a pivoting query https://stackoverflow.com/questions/7674786/mysql-pivot-table ... but hard to say for sure without example data and expected output.. i advice you to read this "Why should I provide an MCVE for what seems to me to be a very simple SQL query?" https://meta.stackoverflow.com/questions/333952/why-should-i-provide-an-mcve-for-what-seems-to-me-to-be-a-very-simple-sql-query – Raymond Nijland Nov 06 '18 at 14:45
  • From the title of your question: "results are not described properly". The query is returning exactly what you're telling it to. If you need different results, you'll have to change your query accordingly. As others have said, we can help you only if you provide the minimum necessary information. Also, please clarify the `Total_Amount` field of your `Invoices` table: Is this a `VARCHAR` field? If you're storing price information, this needs to be a `DECIMAL`-type field. – Zack Nov 06 '18 at 16:11

1 Answers1

0

You should pick (select) at least one column that is the same of both tables, and make a join statement per that column in order to get desired result.