Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

COMBINE TWO QUERIES

Posted on 2008-10-16
2
Medium Priority
?
229 Views
Last Modified: 2012-05-05
Does anyone know why I can run this queries?

SELECT "Student ID", "Student Name" FROM "STUDENT DATA"
WHERE "Crs No" = 10 UNION ALL SELECT * FROM RVM9525.course WHERE  
courseNo = 10

It's giving error massage: query block has incorrect number of result columns
0
Comment
Question by:Dhehien
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 1000 total points
ID: 22733774
RVM9525.course must have more than 2 columns

you are querying 2 columns from the first table
but you are unioning it to an unknown number of columns in the second table.
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 22733778
SELECT *

is returning more that 2 columns!
either change the * into 2 columns, or add some dummy (null) values in the first part

note: SELECT * should really not be used in UNION queries...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question