You are here: Re: Conditional query results « MsSQL Server « IT news, forums, messages
Re: Conditional query results

Posted by --CELKO-- on 12/21/06 17:51

Can you fix up tyhis DDL? You seem to tell us that in Table C, we have
a VIEW of A.col1 and B.col1, but not rule for building this VIEW. You
also have no DDL delcaring keys and all columns are NULL-able so these
are not really tables at all! Is Table D a PK-FK relationship? In
which direction? Where did all those temp tables come from? Why do so
many of the data elements have the same names?

Just trying to make the abstrations human readable and put in questions
on the lack of specs:

CREATE TABLE Alpha
(alpha_id INTEGER NOT NULL PRIMARY KEY. - wild guess!!
alpha_name CHAR(5) NOT NULL);

CREATE TABLE Beta
(beta_id INTEGER NOT NULL PRIMARY KEY. -- wild guess!!
col2 INTEGER NOT NULL);

CREATE VIEW Gamma (alpha_id, beta_id)
AS
SELECT alpha_id, beta_id
FROM Alpha, Beta
WHERE << unknown search condiition>>; -- not possible to guess

CREATE TABLE Delta
(alpha_id INTEGER NOT NULL PRIMARY KEY
REFERENCES Alpha(alpha_id), -- or is this refernced by Alpha?
delta_name CHAR(6) NOT NULL);

Your first criteria wants four columns back, your second criteria wants
five columns back.
But tables do not have a variable number of columns, so this makes no
sense. Oh, even empty result sets have columns, which you did not show
in your vague personal narrative.

The correct syntax is "x IN (<list of expressions>)" and not "x = [exp1
OR exp2 OR ..]

Whenteh specs are this bad and vague, the usual answer is that the DDL
is a nightmare.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация