473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Subquery IN+SELECT blues

I have two tables, meetings and tasks. In the meetings table I have meeting
information and a meeting index called id. In the tasks table I have task
information that is associated with various meetings. In the tasks table I
have a meetingid column that corresponds with the id in the meetings table.
There is also a boolean column called complete which marks the task complete
or not.

What I want to do is display only the meetings for which there are no tasks,
and for which all tasks have been completed. To show the meetings with no
tasks here's what I worked up:

SELECT meetings.* FROM meetings LEFT JOIN tasks ON
meetings.id=tasks.meetingid WHERE tasks.meetingid IS NULL

But that shows only the meetings for which there are no tasks. Ideally I
would have something like:

SELECT * FROM meetings WHERE id NOT IN (SELECT meetingid FROM tasks WHERE
complete=0)

Which I believe will return a list of meetings for which there are either no
tasks or for which all tasks are complete (complete=1). But it seems that
MySQL 4.1a (which I'm running) doesn't support subqueries as part of an IN.
Is there any way to achieve the same result without using the IN (subquery)?

Jason

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1286

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Lakshmi Narayanan.R | last post by:
Hi Experts, Using keyword "To" in select case giving error.The following code is got from www.microsrosoft.com itself. What is the wrong with this?. <% Dim Number1 Number1 = 7 ' Initialize...
2
by: David Emme | last post by:
Access 97 I have a number of SELECT statements which contain references to user-defined VBA functions. These typically work as expected, but occasionally, on one user's machine or another,...
2
by: Pavel Stehule | last post by:
Hello, Pg make query 1. and 2. very fast (use index), but for query 3. dont use index. I can solve its using select union, but I readed so pg 7.5 don't problem with OR operator. I use cvs pg. I...
1
by: bpforte | last post by:
Hello, I need help with building query, basically I need to select all records from one table that don't exists in second table with status 1, but they can exists in second table with status 0, to...
1
by: btonnet | last post by:
<SELECT NAME="id" SIZE="1"> <OPTION VALUE=''>Migo<sup>sm</sup></OPTION> </Select> I m not able to get text superscipted in select/dropdown list of HTML page. Sone please adivce Thanks, bt
18
by: Ron Garret | last post by:
Here's my code. It's a teeny weeny little HTTP server. (I'm not really trying to reinvent the wheel here. What I'm really doing is writing a dispatching proxy server, but this is the shortest...
8
by: Mehbs | last post by:
I created a very simple form. There are 2 text boxes; 1 for entering account number and other to display its desription. I also placed buttom so when it is clicked, select statement underneath...
4
by: Patrick Nolan | last post by:
I am using javascript to manipulate optgroups in select elements. When the results are displayed in Firefox 2.0 there is an annoying blank line at the top of the multi-line select box. This...
3
by: DanielT | last post by:
Hi guys, I am new here. I need to put the below if else condition in select statement, is it possible? if task_is_trunk = 1 (select branch_name from dbo.tblBranch where task_location_guid =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.