Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Query with keys and maybe a cursor !
In article <91anur$r5j$1_at_nnrp1.deja.com>,
Mark D Powell <markp7832_at_my-deja.com> wrote:
> In article <Pine.SOL.4.10.10012141535240.18170-
> 100000_at_kairos.algonet.se>,
> Jarmo Harju <jamppi_at_algonet.se> wrote:
> > Hi !!
> >
> > i have 2 tabels
> > the first one with lots of product
> > and the next one with a load of descriptions of the products
> > and the only way to receive the descriptions is by comming up with a
> > key combined of 2 post in the products tabel.
> >
> > this is the query im using when taking out single posts
> >
> > SELECT description FROM products WHERE
> > Productid ='something' and producttype ='something'
> > and YearModelIn =< '1191 and ModelOutYear >= '1998';
> >
> > my question is ! how do i get this one to go thru all records
> > in the database, i wnt all the desciptions for every product
> > slammed to gether to a new tabell ??
> > i guess i need to create som kind of Cursor and loop thru all the
post ?
> >
> > but how do i do it ??
> >
> > /JArmo
> >
> I am a little bit confused by the wording of your post but what I
think
> you want is to perform a join. Whenever you need data from more than
> one table in one result set you write a query which joins the tables
> together using columns from each table that hold common values. In
the
> absence of your table descriptions here is a generalized example:
>
> select A.product_id, A.col2, B.description
> from product A
> ,descriptsion B
> where A.product_id = B.product_id ;
>
> Anyway, I hope this is one some help to you.
>
> --
> Mark D. Powell -- The only advice that counts is the advice that
> you follow so follow your own advice --
>
> Sent via Deja.com
> http://www.deja.com/
> Hi,
Mark's answer will do the trick..quick note tho'..and it's probably just
a typo in your WHERE clause...add a second single quote after '1191..
<pasted>
and YearModelIn =< '1191 and ModelOutYear >= '1998';
Hth,
Steve
Sent via Deja.com
http://www.deja.com/
Received on Thu Dec 14 2000 - 09:24:54 CST
![]() |
![]() |