RE: Help with query
Posted in 2003
Topics: General Discussion
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C31BB6.93EB3910
Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C31BB6.93EB3910"
------_=_NextPart_001_01C31BB6.93EB3910
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Try something like this :=20
Select a.id , a.desc from Item a=20
where id IN ( select b.link from Item b =20
where desc =3D "Other")
=A0
=A0
=A0
-----Original Message-----
From: Christopher J. Erdal [mailto:chris@No-Spam-erdal.net]
Sent: 16 May 2003 14:01
To: informix-list@iiug.org
Subject: Re: Help with query
Dylan Reinhold <Dylan@non.none> wrote in
news:3EC419A0.425FF452@non.none:=20
> I hope some one can help me with this. I have a table (item) with the
> following columns (id, desc, link) and others that dont matter for
> this.
> Some sample data in the table is
> id desc link
> --- ----- -----
> 002 ITEM1 000
> 003 ITEM2 000
> 901 Other 002
> 902 Other 003
>=20
> Now I need to search for the decr of "Other" then take the "link"
> number (002 & 003) and find the matching "id" as in "ITEM1" & "ITEM2"
> and show the id & decr. eg: I would get back
> -----
> 002 ITEM1
> 003 ITEM2
>=20
> I hope this makes sense.
>=20
> Thanks,
> Dylan
>=20
>=20
>=20
try:
SELECT A.id, A.desc
FROM item A, item B
WHERE B.desc =3D "Other"
AND A.id =3D B.link
ORDER BY id
chris
(I've not tested it)
=20
The information in this email is confidential and may be legally privileged=
. It is intended solely for the addressee. Access to this email by anyone e=
lse is unauthorised.if you are not the intended recipient, any disclosure, =
copying, distribution, or any action taken or omitted to be taken in relian=
ce on it is prohibited and may be unlawful. Please note that any views, opi=
nions or advice contained in this email are those of the sending individual=
and not necessarily those of the firm. It is possible for data transmitted=
by e-mail to be deliberately or accidentally corrupted or intercepted. For=
this reason, where the communication is by e-mail, J&E Davy does not accep=
t any responsibility for any breach of confidence which may arise from the =
use of this medium. If you have received this e-mail in error please notify=
us immediately at mailto:helpdesk@davy.ie and delete this e-mail from your=
system.
------_=_NextPart_001_01C31BB6.93EB3910
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Diso-8859-=
1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 5.5.2653.12">
<TITLE>RE: Help with query</TITLE>
</HEAD>
<BODY>
<BR>
<BR>
<P><FONT SIZE=3D2> Try something like this : </FONT>
</P>
<BR>
<P><FONT SIZE=3D2>Select a.id , a.desc from Item a </FONT>
<BR><FONT SIZE=3D2> where id IN ( select b.link from Item=
b </FONT>
<BR><FONT SIZE=3D2> &n=
bsp; where desc =3D &=
quot;Other")</FONT>
</P>
<P><FONT SIZE=3D2>=A0</FONT>
<BR><FONT SIZE=3D2>=A0</FONT>
<BR><FONT SIZE=3D2>=A0</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Christopher J. Erdal [<A HREF=3D"mailto:chris@No-S=
pam-erdal.net">mailto:chris@No-Spam-erdal.net</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: 16 May 2003 14:01</FONT>
<BR><FONT SIZE=3D2>To: informix-list@iiug.org</FONT>
<BR><FONT SIZE=3D2>Subject: Re: Help with query</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>Dylan Reinhold <Dylan@non.none> wrote in</FONT>
<BR><FONT SIZE=3D2>news:3EC419A0.425FF452@non.none: </FONT>
</P>
<P><FONT SIZE=3D2>> I hope some one can help me with this. I have a tabl=
e (item) with the</FONT>
<BR><FONT SIZE=3D2>> following columns (id, desc, link) and others=
that dont matter for</FONT>
<BR><FONT SIZE=3D2>> this.</FONT>
<BR><FONT SIZE=3D2>> Some sample data in the table is</FONT>
<BR><FONT SIZE=3D2>> id desc link</FONT>
<BR><FONT SIZE=3D2>> --- ----- -----</FONT>
<BR><FONT SIZE=3D2>> 002 ITEM1 000</FONT>
<BR><FONT SIZE=3D2>> 003 ITEM2 000</FONT>
<BR><FONT SIZE=3D2>> 901 Other 002</FONT>
<BR><FONT SIZE=3D2>> 902 Other 003</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Now I need to search for the decr of "Other&qu=
ot; then take the "link"</FONT>
<BR><FONT SIZE=3D2>> number (002 & 003) and find the matching "=
id" as in "ITEM1" & "ITEM2"</FONT>
<BR><FONT SIZE=3D2>> and show the id & decr. eg: I would get back</F=
ONT>
<BR><FONT SIZE=3D2>> -----</FONT>
<BR><FONT SIZE=3D2>> 002 ITEM1</FONT>
<BR><FONT SIZE=3D2>> 003 ITEM2</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> I hope this makes sense.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Thanks,</FONT>
<BR><FONT SIZE=3D2>> Dylan</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>try:</FONT>
</P>
<P><FONT SIZE=3D2>SELECT A.id, A.desc</FONT>
<BR><FONT SIZE=3D2>FROM item A, item B</FONT>
<BR><FONT SIZE=3D2>WHERE B.desc =3D "Other"</FONT>
<BR><FONT SIZE=3D2>AND A.id =3D B.link</FONT>
<BR><FONT SIZE=3D2>ORDER BY id</FONT>
</P>
<P><FONT SIZE=3D2>chris</FONT>
</P>
<P><FONT SIZE=3D2>(I've not tested it)</FONT>
<BR><FONT SIZE=3D2> </FONT>
</P>
<P><FONT FACE=3D"Arial" SIZE=3D2 COLOR=3D"#000000"></FONT>
<CODE><FONT SIZE=3D3><BR>
<BR>
The information in this email is confidential and may be legally privileged=
. It is intended solely for the addressee. Access to this email by anyone e=
lse is unauthorised.if you are not the intended recipient, any disclosure, =
copying, distribution, or any action taken or omitted to be taken in relian=
ce on it is prohibited and may be unlawful. Please note that any views, opi=
nions or advice contained in this email are those of the sending individual=
and not necessarily those of the firm. It is possible for data transmitted=
by e-mail to be deliberately or accidentally corrupted or intercepted. For=
this reason, where the communication is by e-mail, J&E Davy does not accep=
t any responsibility for any breach of confidence which may arise from the =
use of this medium. If you have received this e-mail in error please notify=
us immediately at mailto:helpdesk@davy.ie and delete this e-mail from your=
system.<BR>
</FONT></CODE>
</BODY>
</HTML>
------_=_NextPart_001_0