Solved

COMBINE TWO QUERIES

Posted on 2008-10-16
2
178 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 73

Accepted Solution

by:
sdstuber earned 250 total points
Comment Utility
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 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now