Re: SQL select
| From: | sven | Date: | Thu, 10 Jul 2003 10:05:43 +0000 |
| Subject: | Re: SQL select | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154695@lists.php.net to get a copy of this message | ||
hi,
JiøîÆèî eË wrote:
> hello,
>
> i have got a problem with SQL select:
>
> I have got a table such this:
>
> id_k typ name id
> 1 f bla1 1
> 2 f bla2 1
> 2 i bla3 1
> 3 z bla4 1
> 3 f bla5 1
> 4 i bla6 1
> 4 z bla7 1
> 5 z bla8 1
>
> and id = 1 and I need select these rows:
>
> id_k typ nazev id
> 1 f bla1 1
> 2 f bla2 1
> 3 f bla5 1
> 4 i bla6 1
>
> so, when doesn'i exist component (id_k = component) type "f" so I want
> component with type "i", but when doesn't exist type "f" noir
> "i" I
> don't want to select row with type "z".
>
> jiri nemec, ICQ: 114651500
> www.menea.cz - www stránky a aplikace
don't know, if i correctly understood, but how about this:
SELECT * FROM
YourTable
WHERE typ="f" OR typ="i"
ODER BY typ;