Subject | and again... SQL help needed |
---|---|
Author | Yves Glodt |
Post date | 2003-11-10T21:21:20Z |
Hello,
please consider this query:
SELECT
WT_CORR.EFFECT_DATE,
WT_CORR.CORR_TYPE,
WT_CORR.CORR_STATE,
WT_CORR.CORR_INFO_1,
WT_CORR.CORR_INFO_2,
WT_CORR.CORR_INFO_3,
WT_CORR.TYPE_CORR,
WT_CORR.CREATOR,
WT_NOMS.NAME_NAME,
WT_MOTIFS.REASON_COLOUR,
WT_MOTIFS.REASON_TYPE
FROM WT_CORR,WT_NOMS,WT_MOTIFS
WHERE WT_CORR.IPN=31 AND
WT_CORR.EFFECT_DATE >= $start AND WT_CORR.EFFECT_DATE <= $end AND
WT_NOMS.NAME_TYPE=1400 AND
(WT_CORR.CORR_TYPE = WT_NOMS NAME_NUMBER) AND
(WT_CORR.CORR_TYPE = WT_NOMS.REASON_NUMBER)
ORDER BY WT_CORR.EFFECT_DATE
This is a rough draft, but it works well.
The 9th column it returns is the textual name of the numeric value from
column 2. Names are stored in the WT_NOMS table, and in this query are
linked through the section number "WT_NOMS.NAME_TYPE = 1400"
But I need to get another name from the WT_NOMS table, in a section that
I get in the 10th column, which of course will vary for each returned
row...
Is there a way to use values returned in a row in a WHERE clause in the
same query, like "where WT_NOMS.NAME_TYPE=$(value_from_column #10)"
I was thinkin about a subquery, but I would also need a former result in
the WHERE.
Is this possible at all with bare sql?
TIA!
Yves
p.s.
did you know that IBConsole works with wine in Linux? :-)
The native Linux version only crashes here when I login. :-(
Does anyone know another native graphical query tool (best would be
something like winsql) for Linux?
--
Linux 2.4.22-1-k7 #1 Sat Sep 6 02:13:04 EST 2003 i686
22:01:15 up 3:41, 1 user, load average: 0.28, 1.01, 0.73
please consider this query:
SELECT
WT_CORR.EFFECT_DATE,
WT_CORR.CORR_TYPE,
WT_CORR.CORR_STATE,
WT_CORR.CORR_INFO_1,
WT_CORR.CORR_INFO_2,
WT_CORR.CORR_INFO_3,
WT_CORR.TYPE_CORR,
WT_CORR.CREATOR,
WT_NOMS.NAME_NAME,
WT_MOTIFS.REASON_COLOUR,
WT_MOTIFS.REASON_TYPE
FROM WT_CORR,WT_NOMS,WT_MOTIFS
WHERE WT_CORR.IPN=31 AND
WT_CORR.EFFECT_DATE >= $start AND WT_CORR.EFFECT_DATE <= $end AND
WT_NOMS.NAME_TYPE=1400 AND
(WT_CORR.CORR_TYPE = WT_NOMS NAME_NUMBER) AND
(WT_CORR.CORR_TYPE = WT_NOMS.REASON_NUMBER)
ORDER BY WT_CORR.EFFECT_DATE
This is a rough draft, but it works well.
The 9th column it returns is the textual name of the numeric value from
column 2. Names are stored in the WT_NOMS table, and in this query are
linked through the section number "WT_NOMS.NAME_TYPE = 1400"
But I need to get another name from the WT_NOMS table, in a section that
I get in the 10th column, which of course will vary for each returned
row...
Is there a way to use values returned in a row in a WHERE clause in the
same query, like "where WT_NOMS.NAME_TYPE=$(value_from_column #10)"
I was thinkin about a subquery, but I would also need a former result in
the WHERE.
Is this possible at all with bare sql?
TIA!
Yves
p.s.
did you know that IBConsole works with wine in Linux? :-)
The native Linux version only crashes here when I login. :-(
Does anyone know another native graphical query tool (best would be
something like winsql) for Linux?
--
Linux 2.4.22-1-k7 #1 Sat Sep 6 02:13:04 EST 2003 i686
22:01:15 up 3:41, 1 user, load average: 0.28, 1.01, 0.73