welchen SQL-Befehl brauche ich wenn ich bei folgender Tabelle alle Werte einer Reihe nehmen will, wo keine 0 drinne steht ? Wichtig ist hier, dass die Werte die ich brauche immer unterschiedlich sind, mal brauche ich data1, mal data2 und mal data3 (also je nachdem wo keine 0 drinne ist).
User
Code:
user_id - username - usertype - data1 - data2 - data3 1 ichbins 1 1 0 0 2 wirsins 1 0 0 0 3 rhrsins 1 0 1 1
Bei ID 2 dann user_id, username und usertype.
Bei ID 3 dann user_id, username, usertype, data2 und data3.
Ist das einfach umsetzbar ?
EDIT
Eine zweite Option wäre natürlich solche:
Code:
user_id - username - usertype - data1 - data2 - data3 1 ichbins 1 1 0 0 2 wirsins 1 1 1 0 3 rhrsins 1 1 1 1
Bei ID 2 (mit 2 Informationen) dann bis zu data2.
Bei ID 3 (mit 3 Informationen) dann bis zu data3.
Die Anzahl an Informationen könnte ich auch als Variable im Vorfeld speichern (z.B. $amount_information = 5 wenn ich bis zu data2 will ... heißt also insgesamt dann 5 Spalten user_id, username, usertype, data1 und data2 von einer Reihe ).
Grüße,
Legithos






