Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-21-2008, 05:54 AM
 
Posts: n/a
Default find missing evaluations

We are trying to determine which people have not yet turned in
evaluations for particular presentations

The evaluation table has the following structure
> describe evs;

+-----------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| prsn_id | int(11) | NO | | NULL | |
| prsntn_id | int(11) | NO | | NULL | |
+-----------------+---------+------+-----+---------+----------------+

the presentation table is as follows:

mysql> describe prsnttns;
+-----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| ttl | varchar(255) | YES | | NULL | |
+-----------+--------------+------+-----+---------+----------------+

What we want to know is for each person (identified as prsn_id) which
evaluations have not yet been turned in. In this case, for a particular
presentation id (prsntn_id) we want to know if there exists a row in
the ev table for that person (prsn_id), indicating an evaluation was
entered. My understanding of joins is quite limited. I can determine
which presentations have NO evaluations via the following:

select evs.prsn_id,prsntns.id from prsntns left join evs on
evs.prsntn_id=prsntns.id where evs.prsn_id is null;

but that is not quite what I want. Any suggestions would be appreciated.

Tim

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-21-2008, 09:15 AM
Captain Paralytic
 
Posts: n/a
Default Re: find missing evaluations

On 21 May, 05:54, <t...@tonto.stanford.edu> wrote:
> We are trying to determine which people have not yet turned in
> evaluations for particular presentations
>
> The evaluation table has the following structure> describe evs;
>
> +-----------------+---------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +-----------------+---------+------+-----+---------+----------------+
> | id | int(11) | NO | PRI | NULL | auto_increment |
> | prsn_id | int(11) | NO | | NULL | |
> | prsntn_id | int(11) | NO | | NULL | |
> +-----------------+---------+------+-----+---------+----------------+
>
> the presentation table is as follows:
>
> mysql> describe prsnttns;
> +-----------+--------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +-----------+--------------+------+-----+---------+----------------+
> | id | int(11) | NO | PRI | NULL | auto_increment |
> | ttl | varchar(255) | YES | | NULL | |
> +-----------+--------------+------+-----+---------+----------------+
>
> What we want to know is for each person (identified as prsn_id) which
> evaluations have not yet been turned in. In this case, for a particular
> presentation id (prsntn_id) we want to know if there exists a row in
> the ev table for that person (prsn_id), indicating an evaluation was
> entered. My understanding of joins is quite limited. I can determine
> which presentations have NO evaluations via the following:
>
> select evs.prsn_id,prsntns.id from prsntns left join evs on
> evs.prsntn_id=prsntns.id where evs.prsn_id is null;
>
> but that is not quite what I want. Any suggestions would be appreciated.
>
> Tim


From your description, I do not see that a JOIN is required:
SELECT
*
FROM evs
WHERE prsntn_id = x and prsn_id = y
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:59 AM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.