AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

subselect or join

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
kjc
Guest





PostPosted: Thu Aug 26, 2004 9:14 pm    Post subject: subselect or join Reply with quote



Not sure if this is the right group to post this to but.

This is the current query that I have.

select tableA.id,tableB.artist,tableB.image,from tableA,tableB where
tableA.image = tableB.image AND tableB.price >0 AND tableB.price < 20
order by tableB.price DESC'

What I need is, for each row returned I need information from a third
and fourth table. tableC, and tableD.


tableC has information ( the tableA.id = tableC.eventId) that I need to
obtain tableC.accountId = tableD.accountID in order do select the
the binding information in tableD between a Vendor(name,address..etc..)
and tableB.image

Any help would be greatly appreciated.

Back to top
Erwin Moller
Guest





PostPosted: Tue Sep 07, 2004 8:39 am    Post subject: Re: subselect or join Reply with quote



kjc wrote:

Quote:
Not sure if this is the right group to post this to but.

This is the current query that I have.

select tableA.id,tableB.artist,tableB.image,from tableA,tableB where
tableA.image = tableB.image AND tableB.price >0 AND tableB.price < 20
order by tableB.price DESC'

What I need is, for each row returned I need information from a third
and fourth table. tableC, and tableD.


tableC has information ( the tableA.id = tableC.eventId) that I need to
obtain tableC.accountId = tableD.accountID in order do select the
the binding information in tableD between a Vendor(name,address..etc..)
and tableB.image

Any help would be greatly appreciated.

Hi,

That is kind of hard to say.
You need to define which rows from TableC and TableD you want in your set.
So how they should be joined.
It is also perfectly possible your database is designed in poor way.

Check this for a primer on SQL:
http://www.w3schools.com/ and check SQL

Regards,
Erwin Moller

Back to top
Chuck Simpson
Guest





PostPosted: Sun Sep 12, 2004 8:17 pm    Post subject: Re: subselect or join Reply with quote



On Thu, 26 Aug 2004 21:14:15 +0000, kjc wrote:

Quote:
Not sure if this is the right group to post this to but.

This is the current query that I have.

select tableA.id,tableB.artist,tableB.image,from tableA,tableB where
tableA.image = tableB.image AND tableB.price >0 AND tableB.price < 20
order by tableB.price DESC'

What I need is, for each row returned I need information from a third and
fourth table. tableC, and tableD.


tableC has information ( the tableA.id = tableC.eventId) that I need to
obtain tableC.accountId = tableD.accountID in order do select the the
binding information in tableD between a Vendor(name,address..etc..) and
tableB.image

Any help would be greatly appreciated.

You probably want something like the following:

select
a.id, b.image, b.artist,
c.*, d.*
from
tableA a,
tableB b,
tableC c,
tableD d
where
a.image = b.image and
b.price > 0 and
b.price < 20 and
a.id = c.eventId and
c.accountId = d.accountId

You can specify the fields you need from tableC and tableD instead
of using c.* and d.* as I did in the select list.

Chuck


Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.