7 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
SELECT people.ID_person, firstname, lastname, title, phone1, phone2, mail1, mail2, mobile, fax, comment
FROM people
JOIN belongs_to ON people.ID_person = belongs_to.ID_person
JOIN countries AS nationality ON belongs_to.ID_country = nationality.ID_country
JOIN has_regional_experience ON people.ID_person = has_regional_experience.ID_person
JOIN countries AS experience ON has_regional_experience.ID_country = experience.ID_country
JOIN owns ON people.ID_person = owns.ID_person
JOIN expertise ON owns.ID_expertise = expertise.ID_expertise
JOIN spoke ON people.ID_person = spoke.ID_person
JOIN languages ON spoke.ID_language = languages.ID_language
JOIN worked_for ON people.ID_person = worked_for.ID_person
JOIN donors ON worked_for.ID_donor = donors.ID_donor
WHERE nationality.country='Andorra'
GROUP BY people.ID_person
Quoteii mysql-server 4.0.24-5 mysql database server binaries
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if (grep {$_ eq 'experience.country'} ($self->{field1}, $self->{field2}, $self->{field3})) {
$sqlquery .= q#
JOIN has_regional_experience ON people.ID_person = has_regional_experience.ID_person
JOIN countries AS experience ON has_regional_experience.ID_country = experience.ID_country
#;
}
if (grep {$_ eq 'nationality.country'} ($self->{field1}, $self->{field2}, $self->{field3})) {
$sqlquery .= q#
JOIN belongs_to ON people.ID_person = belongs_to.ID_person
JOIN countries AS nationality ON belongs_to.ID_country = nationality.ID_country
#;
}
if (grep {$_ eq 'expertise'} ($self->{field1}, $self->{field2}, $self->{field3})) {
$sqlquery .= q#
JOIN owns ON people.ID_person = owns.ID_person
JOIN expertise ON owns.ID_expertise = expertise.ID_expertise
#;
}
if (grep {$_ eq 'language'} ($self->{field1}, $self->{field2}, $self->{field3})) {
$sqlquery .= q#
JOIN spoke ON people.ID_person = spoke.ID_person
JOIN languages ON spoke.ID_language = languages.ID_language
#;
}
if (grep {$_ eq 'donor'} ($self->{field1}, $self->{field2}, $self->{field3})) {
$sqlquery .= q#
JOIN worked_for ON people.ID_person = worked_for.ID_person
JOIN donors ON worked_for.ID_donor = donors.ID_donor
#;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
my %sql = ('experience.country' => q#JOIN has_regional_experience ON people.ID_person = has_regional_experience.ID_person
JOIN countries AS experience ON has_regional_experience.ID_country = experience.ID_country
#,
'nationality.country' => q#JOIN belongs_to ON people.ID_person = belongs_to.ID_person
JOIN countries AS nationality ON belongs_to.ID_country = nationality.ID_country
#,
'expertise' => q#JOIN owns ON people.ID_person = owns.ID_person
JOIN expertise ON owns.ID_expertise = expertise.ID_expertise
#,
'language' => q#JOIN spoke ON people.ID_person = spoke.ID_person
JOIN languages ON spoke.ID_language = languages.ID_language
#,
'donor' => q# JOIN worked_for ON people.ID_person = worked_for.ID_person
JOIN donors ON worked_for.ID_donor = donors.ID_donor
#);
$sqlquery .= $sql{$self->{field1}}.$sql{$self->{field2}}.$sql{$self->{field3}}
7 Einträge, 1 Seite |