Ja, das meine ich, existiert der Datensatz noch in um_rights?firstlord18 hat gesagt.:wo genau jetzt? In der Tabelle oder wo?
Gruß hpvw
Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
Ja, das meine ich, existiert der Datensatz noch in um_rights?firstlord18 hat gesagt.:wo genau jetzt? In der Tabelle oder wo?
--
-- Tabellenstruktur für Tabelle `um_groups`
--
CREATE TABLE `um_groups` (
`id` int(10) NOT NULL auto_increment,
`groupname` varchar(120) collate latin1_general_ci NOT NULL default '',
`art` varchar(20) collate latin1_general_ci NOT NULL default 'by_user',
`autogetnewright` int(2) NOT NULL default '-1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=5 ;
--
-- Daten für Tabelle `um_groups`
--
INSERT INTO `um_groups` VALUES (1, 'admin', 'special', 1);
INSERT INTO `um_groups` VALUES (2, 'asdasd', 'special', -1);
INSERT INTO `um_groups` VALUES (3, 'gruppe1', 'special', -1);
INSERT INTO `um_groups` VALUES (4, 'gruppe2', 'special', -1);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `um_groups_rights`
--
CREATE TABLE `um_groups_rights` (
`groups_id` int(10) NOT NULL default '0',
`rights_id` int(10) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
--
-- Daten für Tabelle `um_groups_rights`
--
INSERT INTO `um_groups_rights` VALUES (1, 1);
INSERT INTO `um_groups_rights` VALUES (1, 2);
INSERT INTO `um_groups_rights` VALUES (1, 3);
INSERT INTO `um_groups_rights` VALUES (1, 4);
INSERT INTO `um_groups_rights` VALUES (1, 5);
INSERT INTO `um_groups_rights` VALUES (1, 6);
INSERT INTO `um_groups_rights` VALUES (1, 7);
INSERT INTO `um_groups_rights` VALUES (1, 8);
INSERT INTO `um_groups_rights` VALUES (1, 9);
INSERT INTO `um_groups_rights` VALUES (1, 10);
INSERT INTO `um_groups_rights` VALUES (1, 11);
INSERT INTO `um_groups_rights` VALUES (1, 12);
INSERT INTO `um_groups_rights` VALUES (1, 13);
INSERT INTO `um_groups_rights` VALUES (2, 2);
INSERT INTO `um_groups_rights` VALUES (2, 3);
INSERT INTO `um_groups_rights` VALUES (2, 4);
INSERT INTO `um_groups_rights` VALUES (2, 5);
INSERT INTO `um_groups_rights` VALUES (2, 6);
INSERT INTO `um_groups_rights` VALUES (2, 7);
INSERT INTO `um_groups_rights` VALUES (2, 8);
INSERT INTO `um_groups_rights` VALUES (2, 9);
INSERT INTO `um_groups_rights` VALUES (2, 10);
INSERT INTO `um_groups_rights` VALUES (2, 11);
INSERT INTO `um_groups_rights` VALUES (2, 12);
INSERT INTO `um_groups_rights` VALUES (2, 13);
INSERT INTO `um_groups_rights` VALUES (1, 14);
INSERT INTO `um_groups_rights` VALUES (3, 2);
INSERT INTO `um_groups_rights` VALUES (3, 3);
INSERT INTO `um_groups_rights` VALUES (3, 4);
INSERT INTO `um_groups_rights` VALUES (3, 5);
INSERT INTO `um_groups_rights` VALUES (3, 6);
INSERT INTO `um_groups_rights` VALUES (3, 7);
INSERT INTO `um_groups_rights` VALUES (3, 8);
INSERT INTO `um_groups_rights` VALUES (3, 9);
INSERT INTO `um_groups_rights` VALUES (3, 10);
INSERT INTO `um_groups_rights` VALUES (3, 11);
INSERT INTO `um_groups_rights` VALUES (3, 12);
INSERT INTO `um_groups_rights` VALUES (3, 13);
INSERT INTO `um_groups_rights` VALUES (3, 14);
INSERT INTO `um_groups_rights` VALUES (4, 8);
INSERT INTO `um_groups_rights` VALUES (4, 9);
INSERT INTO `um_groups_rights` VALUES (4, 10);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `um_rights`
--
CREATE TABLE `um_rights` (
`id` int(10) NOT NULL auto_increment,
`rightname` varchar(120) collate latin1_general_ci NOT NULL default '',
`php_id` varchar(100) collate latin1_general_ci NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=15 ;
--
-- Daten für Tabelle `um_rights`
--
INSERT INTO `um_rights` VALUES (1, 'standartrecht - do not delete!', 'default');
INSERT INTO `um_rights` VALUES (2, 'eigene einstellungen bearbeiten!', 'edit_own_prefs');
INSERT INTO `um_rights` VALUES (3, 'gruppen anlegen', 'create_groups');
INSERT INTO `um_rights` VALUES (4, 'gruppen löschen', 'delete_groups');
INSERT INTO `um_rights` VALUES (5, 'gruppen editieren', 'edit_groups');
INSERT INTO `um_rights` VALUES (6, 'user erstellen', 'create_users');
INSERT INTO `um_rights` VALUES (7, 'user löschen', 'delete_users');
INSERT INTO `um_rights` VALUES (8, 'user editierren', 'edit_users');
INSERT INTO `um_rights` VALUES (9, 'rechte erstellen', 'create_rights');
INSERT INTO `um_rights` VALUES (10, 'rechte löschen', 'delete_rights');
INSERT INTO `um_rights` VALUES (11, 'rechte editieren', 'edit_rights');
INSERT INTO `um_rights` VALUES (12, 'scripteinstellungen bearbeiten', 'edit_script_prefs');
INSERT INTO `um_rights` VALUES (13, 'datenbankbackup anlegen', 'create_db_backup');
INSERT INTO `um_rights` VALUES (14, 'asd', 'asd');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `um_users`
--
CREATE TABLE `um_users` (
`id` int(10) NOT NULL auto_increment,
`username` varchar(100) collate latin1_general_ci NOT NULL default '',
`password` varchar(100) collate latin1_general_ci NOT NULL default '',
`icq` varchar(20) collate latin1_general_ci NOT NULL default '',
`mail` varchar(50) collate latin1_general_ci NOT NULL default '',
`random_id` varchar(25) collate latin1_general_ci default '',
`autogetnewright` int(2) NOT NULL default '-1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=4 ;
--
-- Daten für Tabelle `um_users`
--
INSERT INTO `um_users` VALUES (1, 'admin', 'admin', '', '', '626562822', 1);
INSERT INTO `um_users` VALUES (2, 'User2', '', '', '', '', -1);
INSERT INTO `um_users` VALUES (3, 'User3', '', '', '', '', -1);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `um_users_groups`
--
CREATE TABLE `um_users_groups` (
`users_id` int(10) NOT NULL default '0',
`groups_id` int(10) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
--
-- Daten für Tabelle `um_users_groups`
--
INSERT INTO `um_users_groups` VALUES (1, 1);
INSERT INTO `um_users_groups` VALUES (3, 3);
INSERT INTO `um_users_groups` VALUES (3, 2);
INSERT INTO `um_users_groups` VALUES (2, 4);
INSERT INTO `um_users_groups` VALUES (3, 4);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `um_users_rights`
--
CREATE TABLE `um_users_rights` (
`users_id` int(10) NOT NULL default '0',
`rights_id` int(10) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
--
-- Daten für Tabelle `um_users_rights`
--
INSERT INTO `um_users_rights` VALUES (1, 1);
INSERT INTO `um_users_rights` VALUES (1, 14);
INSERT INTO `um_users_rights` VALUES (3, 14);
mysql> select
-> um_rights.id as rightId,
-> substr(um_rights.rightname,1,13) as rightname,
-> um_groups.id as groupId,
-> um_groups.groupname,
-> um_users.id as userId,
-> um_users.username
-> from um_rights
-> left join um_groups_rights
-> on um_groups_rights.rights_id=um_rights.id
-> and um_groups_rights.groups_id>1
-> left join um_groups
-> on um_groups_rights.groups_id=um_groups.id
-> left join um_users_rights
-> on um_users_rights.rights_id=um_rights.id
-> and um_users_rights.users_id>1
-> left join um_users
-> on um_users_rights.users_id=um_users.id
-> where um_rights.id>1
-> order by
-> um_rights.id ASC,
-> um_groups.groupname ASC,
-> um_users.username ASC;
+---------+---------------+---------+-----------+--------+----------+
| rightId | rightname | groupId | groupname | userId | username |
+---------+---------------+---------+-----------+--------+----------+
| 2 | eigene einste | 2 | asdasd | NULL | NULL |
| 2 | eigene einste | 3 | gruppe1 | NULL | NULL |
| 3 | gruppen anleg | 2 | asdasd | NULL | NULL |
| 3 | gruppen anleg | 3 | gruppe1 | NULL | NULL |
| 4 | gruppen lösch | 2 | asdasd | NULL | NULL |
| 4 | gruppen lösch | 3 | gruppe1 | NULL | NULL |
| 5 | gruppen editi | 2 | asdasd | NULL | NULL |
| 5 | gruppen editi | 3 | gruppe1 | NULL | NULL |
| 6 | user erstelle | 2 | asdasd | NULL | NULL |
| 6 | user erstelle | 3 | gruppe1 | NULL | NULL |
| 7 | user löschen | 2 | asdasd | NULL | NULL |
| 7 | user löschen | 3 | gruppe1 | NULL | NULL |
| 8 | user editierr | 2 | asdasd | NULL | NULL |
| 8 | user editierr | 3 | gruppe1 | NULL | NULL |
| 8 | user editierr | 4 | gruppe2 | NULL | NULL |
| 9 | rechte erstel | 2 | asdasd | NULL | NULL |
| 9 | rechte erstel | 3 | gruppe1 | NULL | NULL |
| 9 | rechte erstel | 4 | gruppe2 | NULL | NULL |
| 10 | rechte lösche | 2 | asdasd | NULL | NULL |
| 10 | rechte lösche | 3 | gruppe1 | NULL | NULL |
| 10 | rechte lösche | 4 | gruppe2 | NULL | NULL |
| 11 | rechte editie | 2 | asdasd | NULL | NULL |
| 11 | rechte editie | 3 | gruppe1 | NULL | NULL |
| 12 | scripteinstel | 2 | asdasd | NULL | NULL |
| 12 | scripteinstel | 3 | gruppe1 | NULL | NULL |
| 13 | datenbankback | 2 | asdasd | NULL | NULL |
| 13 | datenbankback | 3 | gruppe1 | NULL | NULL |
| 14 | asd | 3 | gruppe1 | 3 | User3 |
+---------+---------------+---------+-----------+--------+----------+
28 rows in set (0.00 sec)
mysql> delete from um_groups_rights where rights_id=10;
Query OK, 4 rows affected (0.00 sec)
mysql> select
-> um_rights.id as rightId,
-> substr(um_rights.rightname,1,13) as rightname,
-> um_groups.id as groupId,
-> um_groups.groupname,
-> um_users.id as userId,
-> um_users.username
-> from um_rights
-> left join um_groups_rights
-> on um_groups_rights.rights_id=um_rights.id
-> and um_groups_rights.groups_id>1
-> left join um_groups
-> on um_groups_rights.groups_id=um_groups.id
-> left join um_users_rights
-> on um_users_rights.rights_id=um_rights.id
-> and um_users_rights.users_id>1
-> left join um_users
-> on um_users_rights.users_id=um_users.id
-> where um_rights.id>1
-> order by
-> um_rights.id ASC,
-> um_groups.groupname ASC,
-> um_users.username ASC;
+---------+---------------+---------+-----------+--------+----------+
| rightId | rightname | groupId | groupname | userId | username |
+---------+---------------+---------+-----------+--------+----------+
| 2 | eigene einste | 2 | asdasd | NULL | NULL |
| 2 | eigene einste | 3 | gruppe1 | NULL | NULL |
| 3 | gruppen anleg | 2 | asdasd | NULL | NULL |
| 3 | gruppen anleg | 3 | gruppe1 | NULL | NULL |
| 4 | gruppen lösch | 2 | asdasd | NULL | NULL |
| 4 | gruppen lösch | 3 | gruppe1 | NULL | NULL |
| 5 | gruppen editi | 2 | asdasd | NULL | NULL |
| 5 | gruppen editi | 3 | gruppe1 | NULL | NULL |
| 6 | user erstelle | 2 | asdasd | NULL | NULL |
| 6 | user erstelle | 3 | gruppe1 | NULL | NULL |
| 7 | user löschen | 2 | asdasd | NULL | NULL |
| 7 | user löschen | 3 | gruppe1 | NULL | NULL |
| 8 | user editierr | 2 | asdasd | NULL | NULL |
| 8 | user editierr | 3 | gruppe1 | NULL | NULL |
| 8 | user editierr | 4 | gruppe2 | NULL | NULL |
| 9 | rechte erstel | 2 | asdasd | NULL | NULL |
| 9 | rechte erstel | 3 | gruppe1 | NULL | NULL |
| 9 | rechte erstel | 4 | gruppe2 | NULL | NULL |
| 10 | rechte lösche | NULL | NULL | NULL | NULL |
| 11 | rechte editie | 2 | asdasd | NULL | NULL |
| 11 | rechte editie | 3 | gruppe1 | NULL | NULL |
| 12 | scripteinstel | 2 | asdasd | NULL | NULL |
| 12 | scripteinstel | 3 | gruppe1 | NULL | NULL |
| 13 | datenbankback | 2 | asdasd | NULL | NULL |
| 13 | datenbankback | 3 | gruppe1 | NULL | NULL |
| 14 | asd | 3 | gruppe1 | 3 | User3 |
+---------+---------------+---------+-----------+--------+----------+
26 rows in set (0.00 sec)
achso ... ja stimmt, und das gibt ja eigentlich das richtige ergebnis aushpvw hat gesagt.:Nein, im zweiten Query habe ich die Bedingungen vom where in die jeweiligen on-Klauseln verschoben.
Die Ascii-Tabellen "malt" der MySQL-Command-Line-Client, den Du unter Windows nach der Installation von MySQL in der MySQL-Programmgruppe im Startmenü findest oder auch, falls installiert, über den MySQL Administrator aufrufen kannst.
Gruß hpvw