MySQL Forums
Forum List  »  German

Re: Anfängerfrage mehrere Bedingungen
Posted by: Tim P
Date: January 25, 2012 01:32AM

Hallo Thomas,

yippieeee, genau DAS ist das worauf ich hinaus möchte bzw es ist quasi zu 99% die Lösung, sogar mit dem NULL/NOTNULL, da es unerheblich ist, was unter "schalterx" steht. Wichtig ist nur ob gesetzt oder nicht gesetzt!
Was mir jetzt hier fehlt und auch das war ein Knackpunkt bisher, der schalterinhalt muss ja noch abgefragt werden.
Dementsprechend sieht die Tabelle so aus:
CREATE TABLE gesamtbetrag (
id INT NOT NULL,
betrag DEC(6,2),
schalter1 text(5),
schalter2 text(5),
schalter3 text(5),
PRIMARY KEY (id)
);
INSERT INTO gesamtbetrag VALUES
( 1, 100, 'on', 'on', 'on' ),
( 2, 200,' ','on',' ');

mysql> select * from gesamtbetrag;
+----+--------+-----------+-----------+-----------+
| id | betrag | schalter1 | schalter2 | schalter3 |
+----+--------+-----------+-----------+-----------+
| 1 | 100.00 | on | on | on |
| 2 | 200.00 | | on | |
+----+--------+-----------+-----------+-----------+
2 rows in set (0.00 sec)

So schaut das Ganze aus, Dein Beispiel kurz erweitert.

Options: ReplyQuote


Subject
Views
Written By
Posted
2477
January 23, 2012 07:39AM
1111
January 23, 2012 08:45AM
1279
January 23, 2012 01:42PM
1307
January 24, 2012 05:54AM
Re: Anfängerfrage mehrere Bedingungen
1044
January 25, 2012 01:32AM
1158
January 25, 2012 06:40AM
1157
January 26, 2012 10:06AM
1164
January 29, 2012 06:35AM
1228
January 23, 2012 08:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.