Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Linux, Apache, MySQL > MySQL Help

MySQL Help Post any question relating to MySQL here and hopefully someone can help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2006-07-20, 08:36 PM
Junior Member
 
Join Date: Jul 2006
Posts: 1
Azsori- is on a distinguished road
Default Help with querey!!

I am trying to select values from 2 tables, but filter the records returned by value in another table (via sub querey). It works great when there is a value found in that 3rd table. But when there is no value found in the third table, instead return all records in tables 1 and 2, I get nothing. please help, asap.

querey:

select *
from test, category
where test_category_id = category_id
and test_id != (select utest_test_id from utest where utest_user_id = 3)
order by test_id

tables:

mysql> select * from test;
+---------+--------------------+----------------+------------------+-----------------+
| test_id | test_name | test_num_quest | test_category_id | test_time_limit |
+---------+--------------------+----------------+------------------+-----------------+
| 1 | Sample Test | 1 | 1 | 20 |
| 2 | Security Awareness | 2 | 2 | 30 |
+---------+--------------------+----------------+------------------+-----------------+
2 rows in set (0.00 sec)
mysql> select * from category;
+-------------+-----------------+
| category_id | category_name |
+-------------+-----------------+
| 1 | Sample Category |
| 2 | Security |
+-------------+-----------------+
2 rows in set (0.00 sec)
mysql> select * from utest;
+----------+---------------+---------------+---------------------+-------------+------------------+
| utest_id | utest_user_id | utest_test_id | utest_date | utest_score | utest_time_spent |
+----------+---------------+---------------+---------------------+-------------+------------------+
| 1 | 2 | 2 | 2006-07-20 13:58:59 | 1 | 4 |
+----------+---------------+---------------+---------------------+-------------+------------------+
1 row in set (0.00 sec)
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.0 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.0 (a popular PHP IDE) and NuCoder 1.4 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
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

BB 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 +1. The time now is 07:42 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.