Subject | RE: [firebird-support] Help with view |
---|---|
Author | Gabhan O'Loughlin |
Post date | 2003-10-08T14:07:53Z |
>Good Morning all:pointer to a table of reps.
>I am trying to create a view from a mailing list. In this list is a record
>Each maillist record is assigned to a rep. I need to show the reps name (from the reps table )
>when extracting from the maillist table not the rep ID ( used in themaillist table ).
>I am trying to create a view to do that using the following:Try
>CREATE VIEW ALIST ( REPNAME, NAME, ADDRESS )
>AS
>SELECT REPS.REP_NAME, MAILLIST.ML_MAIL_NAME, MAILLIST.ML_MAIL_ADDRESS
>FROM MAILLIST REPS WHERE MAILLIST.ML_REPID =
>( SELECT REPS.REP_NAME FROM REPS WHERE REPS.REP_ID > -1 )
CREATE VIEW ALIST ( REPNAME, NAME, ADDRESS )
AS
SELECT REPS.REP_NAME, MAILLIST.ML_MAIL_NAME, MAILLIST.ML_MAIL_ADDRESS
FROM MAILLIST, REPS WHERE MAILLIST.ML_REPID = REPS.REP_ID
AND REPS.REP_ID > -1
You cannot order the view in the DDL, but :
select * from ALIST order by REPNAME
will order the list just fine...
Gabhan
Input