Re: a bug or intentional? -- problem with multiple table query

2001-11-03 Thread Q

Thanks!  I altered my statements to use left joins and now it all looks like 
it's working!


On Thursday 01 November 2001 09:51 pm, Quentin Bennett wrote:

Hi,

You need to read up on Left Joins, which will insert a 'NULL' row in the
results for B where there isn't a real one.

Regards

Quentin

-Original Message-
From: Q [mailto:[EMAIL PROTECTED]]
Sent: Friday, 2 November 2001 4:40 p.m.
To: [EMAIL PROTECTED]
Subject: a bug or intentional? -- problem with multiple table query


I am having a problem with a query and I don't know if it is a bug or 
intentional.  Anyway any input is greatly appreciated.  Here is a basic
query 
that is simpler than what I am dealing with but should demonstrate my
problem.

Lets say:
SELECT A.1, A.2 FROM A
yeilds:
test1   test2

then:
SELECT A.1, A.2 FROM A, B
yeilds nothing, unless B has something in it.  my problem is that b does not

always have something in it.  I need to have B in the FROM list because I
use 
it in the WHERE statement.

I am curious if this is intentional, but mainly I would like to know if
there 
is a way around it other than putting a dummy entry in the tables.

If anyone cares here is the real query:

SELECT DISTINCT services.serviceid, services.name from admin_permissions, 
pop_permissions, admin_pops, services WHERE 
(concat('service_',services.serviceid)=admin_permissions.object AND 
(admin_permissions.can_change=1 OR admin_permissions.can_grant=1) AND 
admin_permissions.userid=1) OR (concat('service_',services.serviceid)=
pop_permissions.object AND (pop_permissions.can_change=1 OR 
pop_permissions.can_grant=1) AND pop_permissions.popid=admin_pops.popid AND 
admin_pops.userid=1) ORDER BY services.name

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

The information contained in this email is privileged and confidential
and intended for the addressee only. If you are not the intended 
recipient, you are asked to respect that confidentiality and not 
disclose, copy or make use of its contents. If received in error 
you are asked to destroy this email and contact the sender immediately. 
Your assistance is appreciated.



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




a bug or intentional? -- problem with multiple table query

2001-11-01 Thread Q

I am having a problem with a query and I don't know if it is a bug or 
intentional.  Anyway any input is greatly appreciated.  Here is a basic query 
that is simpler than what I am dealing with but should demonstrate my problem.

Lets say:
SELECT A.1, A.2 FROM A
yeilds:
test1   test2

then:
SELECT A.1, A.2 FROM A, B
yeilds nothing, unless B has something in it.  my problem is that b does not 
always have something in it.  I need to have B in the FROM list because I use 
it in the WHERE statement.

I am curious if this is intentional, but mainly I would like to know if there 
is a way around it other than putting a dummy entry in the tables.

If anyone cares here is the real query:

SELECT DISTINCT services.serviceid, services.name from admin_permissions, 
pop_permissions, admin_pops, services WHERE 
(concat('service_',services.serviceid)=admin_permissions.object AND 
(admin_permissions.can_change=1 OR admin_permissions.can_grant=1) AND 
admin_permissions.userid=1) OR (concat('service_',services.serviceid)=
pop_permissions.object AND (pop_permissions.can_change=1 OR 
pop_permissions.can_grant=1) AND pop_permissions.popid=admin_pops.popid AND 
admin_pops.userid=1) ORDER BY services.name

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: a bug or intentional? -- problem with multiple table query

2001-11-01 Thread Quentin Bennett

Hi,

You need to read up on Left Joins, which will insert a 'NULL' row in the
results for B where there isn't a real one.

Regards

Quentin

-Original Message-
From: Q [mailto:[EMAIL PROTECTED]]
Sent: Friday, 2 November 2001 4:40 p.m.
To: [EMAIL PROTECTED]
Subject: a bug or intentional? -- problem with multiple table query


I am having a problem with a query and I don't know if it is a bug or 
intentional.  Anyway any input is greatly appreciated.  Here is a basic
query 
that is simpler than what I am dealing with but should demonstrate my
problem.

Lets say:
SELECT A.1, A.2 FROM A
yeilds:
test1   test2

then:
SELECT A.1, A.2 FROM A, B
yeilds nothing, unless B has something in it.  my problem is that b does not

always have something in it.  I need to have B in the FROM list because I
use 
it in the WHERE statement.

I am curious if this is intentional, but mainly I would like to know if
there 
is a way around it other than putting a dummy entry in the tables.

If anyone cares here is the real query:

SELECT DISTINCT services.serviceid, services.name from admin_permissions, 
pop_permissions, admin_pops, services WHERE 
(concat('service_',services.serviceid)=admin_permissions.object AND 
(admin_permissions.can_change=1 OR admin_permissions.can_grant=1) AND 
admin_permissions.userid=1) OR (concat('service_',services.serviceid)=
pop_permissions.object AND (pop_permissions.can_change=1 OR 
pop_permissions.can_grant=1) AND pop_permissions.popid=admin_pops.popid AND 
admin_pops.userid=1) ORDER BY services.name

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

The information contained in this email is privileged and confidential
and intended for the addressee only. If you are not the intended 
recipient, you are asked to respect that confidentiality and not 
disclose, copy or make use of its contents. If received in error 
you are asked to destroy this email and contact the sender immediately. 
Your assistance is appreciated.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php