[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    mysql: SQL Query For...
From:       <sinisa () beotel ! yu>
Date:       1999-01-31 20:06:21
[Download RAW message or body]

lucifer writes:
 > Hi,
 > 
 > If i have a table as describe below
 > 
 > field_1    field_2
 > ------------
 > a    x
 > a    y
 > b    x
 > c    x
 > d    x
 > d    y
 > 
 > what is the apropriate query to extract only
 > b    x
 > c    x
 > (returning field_1 with field_2 having only 'x') ?
 > 
 > 
 > thanks in advance
 > 
 > gunardi@starindo.net
 > 

Hi!

The way I understand your question right, the answer is too simple:

select xx.field_1, xx.field_2 from table, table as xx where
xx.field2='x' and table.field1=table.field2

Sinisa

+---------------------------------------------------------------------+
| TcX  ____  __     _____   _____  ___        ==  mysql@tcx.se        |
|     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|        Sinisa Milivojevic      |
|    /*/ /*/ /*/   \*\_   |*|   |*||*|        mailto:sinisa@grmec.com |
|   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|        Belgrade                |
|  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|_____   Serbia                  |
|  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^                           |
|             /*/             \*\                   Developers Team   |
+---------------------------------------------------------------------+
-----------------------------------------------------------
Send a mail to mdomo@tcx.se with
unsubscribe mysql your@subscription.address
in the body of the message to unsubscribe from this list.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic