Hi 
I have one problem that i can`t resolve.
I have 3 tables

TABLE `predmet` (
  `PredmetID` int(10) unsigned NOT NULL
auto_increment,
  `BrojPredmeta` int(10) unsigned NOT NULL default
'0',
  `VrstaPredmetaID` int(10) unsigned NOT NULL default
'0',
  `KorisnikID` int(10) unsigned NOT NULL default '0',
  `GrupaID` int(10) unsigned NOT NULL default '0',
  `PodgrupaID` int(10) unsigned NOT NULL default '0',
  `DatumZaduzenja` date NOT NULL default '0000-00-00',
  `DatumRazduzenja` date default NULL,
  `DatumUrgencije` date default NULL,
  `Komentar` text,

TABLE `predmet_referent` (
  `PredmetID` int(10) unsigned NOT NULL default '0',
  `VrstaPredmetaID` int(10) unsigned NOT NULL default
'0',
  `KorisnikID` int(10) unsigned NOT NULL default '0',
  `GrupaID` int(10) unsigned NOT NULL default '0',
  `PodgrupaID` int(10) unsigned NOT NULL default '0',
  `ReferentID` int(10) unsigned NOT NULL default '0',

which reference all from table predmet
and 

CREATE TABLE `referent` (
  `ReferentID` int(10) unsigned NOT NULL
auto_increment,
  `SifraReferenta` varchar(2) NOT NULL default '',
  `ImeReferenta` varchar(30) NOT NULL default '',
  `PrezimeReferenta` varchar(45) NOT NULL default '',
  PRIMARY KEY  (`ReferentID`)

My table predmet_referent looks like this

PredmetID VrstaPredmetaID KorisnikID GrupaID
PodgrupaID ReferentID
1, 1, 18, 4, 4, 1
1, 1, 18, 4, 4, 2
2, 1, 21, 6, 3, 2
2, 1, 21, 6, 3, 3
3, 1, 22, 5, 1, 2
3, 1, 22, 5, 1, 1
3, 1, 22, 5, 1, 3
4, 3, 23, 6, 3, 1
4, 3, 23, 6, 3, 2
4, 3, 23, 6, 3, 3

and table referent looks like

ReferentID SifraReferenta ImeReferenta
PrezimeReferenta
1, '01', 'Nada', 'Nadić'
2, '03', 'Goran', 'Gavrančić'
3, '04', 'Dragan', 'Perišić'

I want to make select query so thatt result from that 
query look something like this

PredmetID BrojPredmeta Referent1 Referent2 Referent3
1          121215          1        2          
2          121355          2        3
3          236564          2        1         3
4          213545          1        2         3

How can i do this?This is very importat for me
Any help will be great.  

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to