General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Why does SQL work but CREATE SQL VIEW doesn't
Hi. I just noticed some wierd behavior. My SQL is based on two unrelated tables. I am trying to create a VIEW with both tables - the Customer table and the Vendor table - with an additional field designating whether it is a customer or vendor. The fields themselves are the same name (or practically). When I run it from the command line as a SELECT ....FROM ... UNION ALL (SELECT .. FROM ...) it works. Yet when I add the CREATE SQL VIEW test AS (SELECT ... FROM ...UNION ALL (SELE ... FROM ...)) it gives me one of two errors - either a connectivity error or an invalid SQL. I've tried the EVIEW.APP too and it gives me the same problem. Does anyone know why?
The following is the actual SQL:
Select arcust.custno as cusven, arcust.company1, arcust.company2, ;
arcust.address1, arcust.address2, LEFT(arcust.city,30) as city, arcust.prov, arcust.country, arcust.postcode, 'AR' as type FROM arcust ;
UNION ALL (select apvend.vendno as cusven, apvend.company1, apvend.company2, apvend.address1, ;
apvend.address2, apvend.city, apvend.prov, apvend.country, apvend.postcode, 'AP' as type from Apvend)
TIA
Sandi
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only