473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

UNION query won't work

I am having alot of trouble with a union query Im trying to create.
The bizarre thing is I initially created this query and managed to
save it as a view

SELECT ID, DepartureDate, City, Country, Region,
fkDepartureAirport, CONVERT(MONEY, Price) AS Price, '1' AS Type
FROM dbo.vHoliday
UNION ALL
SELECT ID, ValidTo, DestCity, Country, Region, fkDepartureAirport,
Price, '2' AS Type
FROM dbo.vFlight
However when I tried to update the view to this:
SELECT ID, DepartureDate, fkCity, City, fkCountry, Country,
Region, fkDepartureAirport, CONVERT(MONEY, Price) AS Price, '1' AS
Type
FROM dbo.vHoliday
UNION ALL
SELECT ID, ValidTo, fkCity, DestCity, fkCountry, Country, Region,
fkDepartureAirport, Price, '2'
FROM dbo.vFlight
it comes up with the error: view definition includes no output columns
or includes no items in the from clause.
Any ideas??????

All suggestions appreciated

Ally
Jul 20 '05 #1
1 3745
why 'union all' shouldn't be enough with: 'union'?
/Bjørn
"Buttercup" <al************@hotmail.com> wrote in message
news:3d**************************@posting.google.c om...
I am having alot of trouble with a union query Im trying to create.
The bizarre thing is I initially created this query and managed to
save it as a view

SELECT ID, DepartureDate, City, Country, Region,
fkDepartureAirport, CONVERT(MONEY, Price) AS Price, '1' AS Type
FROM dbo.vHoliday
UNION ALL
SELECT ID, ValidTo, DestCity, Country, Region, fkDepartureAirport,
Price, '2' AS Type
FROM dbo.vFlight
However when I tried to update the view to this:
SELECT ID, DepartureDate, fkCity, City, fkCountry, Country,
Region, fkDepartureAirport, CONVERT(MONEY, Price) AS Price, '1' AS
Type
FROM dbo.vHoliday
UNION ALL
SELECT ID, ValidTo, fkCity, DestCity, fkCountry, Country, Region,
fkDepartureAirport, Price, '2'
FROM dbo.vFlight
it comes up with the error: view definition includes no output columns
or includes no items in the from clause.
Any ideas??????

All suggestions appreciated

Ally

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: unixman | last post by:
As usual, it is 2:00am, and I'm pulling my hair out, finally resorting to posting in the newsgroups for help. :) Simple problem, in theory. Given table "map": CREATE TABLE map ( entry_id...
3
by: Paradigm | last post by:
I am using Access 2K as a front end to a MYSQL database. I am trying to run a Union query on the MYSQL database. The query is (much simplified) SELECT as ID from faxdata UNION SELECT as ID ...
1
by: Joachim Klassen | last post by:
Hi all, I'm investigating partitioned tables using a UNION ALL VIEW and found the following (see ddl below): If I create a check constraint like "check (month(tdate) = 1)" DB2 won't do branch...
14
by: Salad | last post by:
A97. Situation: I have 3 tables with a text field in each and a date field in the first 2 tables: Table1 Text1, Date1 Table2 Text2, Date2 Table3 Text3 (no date field) The following...
5
by: Alicia | last post by:
Hello everyone based on the data, I created a union query which produces this. SELECT ,,, 0 As ClosedCount FROM UNION SELECT ,, 0 AS OpenedCount, FROM ORDER BY , ;
5
by: Lyn | last post by:
This one is difficult to explain, so I will cut it down to the basics. I have a major table 'tblA' which has an autonum field 'ID-A' as primary key (of no significance to users). 'tblA' contains...
7
by: KoliPoki | last post by:
Hello every body. I have a small issue. Problem: I have a table with 4 descriptor columns (type). I need to formulate a query to retrieve a count for each type so I can group by...etc. The...
6
by: halberd4 | last post by:
Hello. I have an Access2003 db that I need to create a 'combined' query for. This query will then become the source for a listbox. The query needs to combine Query1 (example) SELECT Aa, Bb, Cc,...
27
by: MLH | last post by:
How can I turn the following into a make-table query? SELECT & " " & AS Recipient FROM tblVehicleJobs INNER JOIN tblAddnlOwnrs ON tblVehicleJobs.VehicleJobID = tblAddnlOwnrs.VehicleJobID WHERE...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.