|
The more I learn about SQL, the more I like it. The problem I have is
trying to figure out how to do certain things. Some thinga that seem simple
I just can't seem to figure out or find by searching. I must not have
crossed that line to where I can 'think' in SQL yet.
Here's what I'm trying to do. I have a join logical, ALITMMST, created via
DDS that I want created via SQL DML instead.
The DDS:
A R MBRECORD PFILE(DMITMMST OLITMMST)
A FORMAT(DMITMMST)
A K ITNBR
DMITMMST is active items. OLITMMST is items that have been deleted in the
past 24 months. The purpose of ALITMMST is twofold: 1) the buyers can make
sure they don't reuse an item number within 2 years, and 2) they can use
Query against sales history data using ALITMMST.
To create an equivalent in SQL I cannot say:
CREATE VIEW ALITMMST AS SELECT * FROM DMITMMST UNION SELECT * FROM OLITMMST
because there is 1 additional field in OLITMMST at the end of the format
that doesn't exist in DMITMMST. That field is an *ISO date data type
indicating the date the item was delete. I'm certain something like this:
CREATE VIEW ALITMMST AS SELECT *,DATE('0001-01-01') FROM DMITMMST UNION
SELECT * FROM OLITMMST
cannot be done because I couldn't make anything work nor could I find any
examples anywhere indicating one could add additional fields to a "SELECT *"
statement. There's over 100 fields so I don't really want to key them all
in. There is also the fact that the resulting union has no key.
I tried retrieving the SQL but it fails. I'm assuming I need some kid of
INDEX as opposed to a VIEW. I just can't find any examples on how to do
this. This didn't seem like an odd thing to do.
Is this an example of something that can be done in DDS, but not SQL? I
refuse to believe that to be true.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.