Jump to content

multiple tables one result set...best solution?Temp tables?


Z24_2000

Recommended Posts

Okay,

 

I\'d hate to be long winded, but here we go...I\'m at a crucial point in my program as the foundation I use for this select stmt will be used throughout my application, which is why I came here, because I want to get it right.

 

Background: I have tables named publicationinfo(1), publicationrec(2), luroles(3), luresearher(4), lujournal(5), lupublicationtype(6).

 

table 1 contains the following publication information:

infoid, title, journalvolume, journaldate, datesubmitted,dateaccepted,

fk_typeid, fk_journalid

 

table 2 contains the following linkage information:

recid, fk_infoid, fkstaffid, fk_roleid

 

table 3 contains the following role (author etc...) information:

roleid, roledescription

 

table 4 contains the following researcher information:

staffid, name

 

table 5 contains the following journal information:

journalid, journalname

 

table 6 contains the following publication type (book, paper etc...) information:

typeid, typedescription

 

What I am trying to achieve:

I would like to output a single line per record within the publicationinfo table. Within in this line of output, I would like to see title, journalname, journalvolume, journaldate, datesubmitted, dateaccepted, typedescritption, researcher (all that took part in the publication) and role (each role would be displayed in brackets beside the researcher name).

 

I know this is pretty specific, and I don\'t want anyone to think I\'m looking for a quick answer, because I understand it\'s a pretty complicated query! I\'ve tried to figure it out on my own, and I get as far as joining pubinfo to lupubtype and lujournal, to get a single red for each publication, but I can\'t seem to link through pubrec (linkage table) to select names and roles without outputting one publication per researcher (duplicate info)...anywho, I can post the create table stmts if anyone would like them...but maybe you smart fellows can figure this one out without them, let me know! I realllllllyyyyy appreciate it!

 

Andrew :cry:

Link to comment
Share on other sites

I\'m afraid its a fact of life when joining tables that if table A has 3 matching records in table B then you get 3 rows returned, so if a publication has several researchrs, you get several rows from the query.

 

This doesn\'t preclude you from displaying the data in a single row of a table though. You can always code it to display

 

| publication | researcher 1 | researcher 2 | researcher 3 | etc

 

 

hth

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.