Re: A little problem with SELECT

2003-01-17 Thread Marcos Henke
SELECT a.* FROM company a, employee b
WHERE a.id=b.cid AND
(b.name='joe' OR
b.name='bill');

_
Marcos Henke
_

- Original Message -
From: Roger Baklund [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: Blaster [EMAIL PROTECTED]
Sent: Friday, January 17, 2003 7:51 AM
Subject: Re: A little problem with SELECT


 * Blaster
 [...]
  main company table
  id (int) | company name (varchar) | phone (varchar) | .. more fields
that
  doesn't really matter
 
  employee table (company.id = employee.cid)
  id (int) | cid (int) | name (varchar) | age (int) | email (varchar)
 
  Now, I want to make a search which can search for 2 names and show me if
  there are any company that
  has these names? I tried
 
  SELECT a.* FROM company a, employee b WHERE a.id=b.cid AND
  b.name='joe' OR
  b.name='bill';

 Because you want to check two different names, you must join the employee
 table twice:

 SELECT a.*
   FROM company a, employee b1, employee b2
   WHERE
  a.id=b1.cid AND
  a.id=b2.cid AND
  b1.name='joe' AND
  b2.name='bill';

 --
 Roger
 sql


 -
 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




-
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: help me, please

2002-12-19 Thread Marcos Henke
Select max(No) from table


Marcos Henke

- Original Message -
From: Paul DuBois [EMAIL PROTECTED]
To: mustakim abas [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, December 19, 2002 1:51 PM
Subject: Re: help me, please


 At 8:06 -0800 12/19/02, mustakim abas wrote:
 Hello, i am new in mysql. I got a problem. I try write
 my C program with mysql API.I have 5 field in
 table.No,Name,Phone,Date,Time. How can i take one row
 where the No is bigger?
 Thanks for help.

 Bigger than what?


 -
 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




-
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