Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 25. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  JOIN issue from multiple tables

phpMyEdit General     JOIN issue from multiple tables
Odoslať novú tému   Odpovedať na tému    
 
ned@kelly.org.au     Založený: 08.04.2004   Príspevky: 22   Bydlisko: Mosquito Flat, Australia
Príspevok Zaslal: 2004-06-30 01:41
Návrat hore  Odpovedať s citátom     

Hi again

I have 3 tables

1. Software
- SID
- Sofware_Name

2. Assets
- AID
- Asset_Name (Asset_Name is unique)
- Asset_User

3. Software_On_PCs
- SPCID
- SPC_Asset_Name (comes from Assets:Asset_Name)
- SPC_Software_Name (comes from Software:Software_Name)

And I want in the list view of the Software_On_PCs table the Asset_User(from Assets) to appear as a virtual row, but I cant figure it out

I have tried

Kód:
 
$opts['fdd']['SPC_User'] = array(
  'name'     => 'SPC User',
  'select'   => 'T',
  'maxlen'   => 30,
  'sort'     => true,
  'values'   => array(
    'table'       => 'Assets',
    'column'      => 'Asset_User',
  ),
   'join' => 'Software_on_PCs.SPC_User = Assets.Asset_User'
);



but just cant get it to work, im sure it straight forward

Any help would be greatly appreciated

Cheers

Ned

 
michal     Založený: 17.06.2003   Príspevky: 537   Bydlisko: Slovakia
Príspevok Zaslal: 2004-06-30 10:50
Návrat hore  Odpovedať s citátom     

since the join is already made in another column, it is enough just to call that coulumn. something like

Kód:

'sql' => 'Join4.Asset_user'

(no 'values', no 'join')

note that 'Join4' can be something different and that number can change without warning (if you change the configuration file). mysql error message will show you which number to use (the one with asset_name next to it)

 
ned@kelly.org.au     Založený: 08.04.2004   Príspevky: 22   Bydlisko: Mosquito Flat, Australia
Príspevok Zaslal: 2004-07-01 03:36
Návrat hore  Odpovedať s citátom     

Hi Michal

Thanks for the reply

below is my code

Kód:

$opts['fdd']['SPC_ID'] = array(
  'name'     => 'SPC ID',
  'select'   => 'T',
  'options'  => 'AVCPDR', // auto increment
  'maxlen'   => 11,
  'default'  => '0',
  'sort'     => true
);
$opts['fdd']['SPC_Asset_Name'] = array(
  'name'     => 'SPC Asset Name',
  'select'   => 'D',
  'maxlen'   => 20,
  'required' => true,
  'sort'     => true,
  'values'   => array(
    'table'       => 'Assets',
    'column'      => 'Asset_Name',
  )
);
$opts['fdd']['SPC_Software_Name'] = array(
  'name'     => 'SPC Software Name',
  'select'   => 'D',
  'maxlen'   => 30,
  'sort'     => true,
  'values'   => array(
    'table'       => 'Software',
    'column'      => 'Software_Name',
  )
);
$opts['fdd']['SPC_User3'] = array(
  'name'     => 'SPC User',
  'select'   => 'T',
  'maxlen'   => 30,
  'sort'     => true,
  'sql'      => 'Join2.Asset_User'
);


and it gets the following MySQL error
(i have tried changing Join2 to Join0,1,3,4,5,6 but still get the same error number. as well as PMEjoinX and PMEtabeleX)

Kód:

MySQL error 1109
Unknown table 'Join2' in field list
----------------------------
phpMyEdit error: invalid SQL query
----------------------------
SELECT PMEtable0.SPC_ID AS qf0,PMEtable0.SPC_Asset_Name AS qf1,PMEtable0.SPC_Asset_Name AS qf1_idx,PMEtable0.SPC_Software_Name AS qf2,PMEtable0.SPC_Software_Name AS qf2_idx,Join3.Asset_User AS qf3 FROM Software_on_PCs AS PMEtable0 ORDER BY PMEtable0.SPC_ID,PMEtable0.SPC_Asset_Name LIMIT 0,1515.826 miliseconds


Is there something missing from my code??

Thanks again Michal for all your help

Cheers

Ned

 
michal     Založený: 17.06.2003   Príspevky: 537   Bydlisko: Slovakia
Príspevok Zaslal: 2004-07-01 15:41
Návrat hore  Odpovedať s citátom     

as i see there is no join clase in that sql, so pme is doing some optimalization for unneccessary code. i didn't know it's that good :)

the easiest solution i see is 'values' for spc_user (with appropriate description field) and standard output on spc_software_name (no join is neccessary). (at least for the view part)

you can leave current state in AC mode, if that fits you better.

 
ned@kelly.org.au     Založený: 08.04.2004   Príspevky: 22   Bydlisko: Mosquito Flat, Australia
Príspevok Zaslal: 2004-07-02 04:39
Návrat hore  Odpovedať s citátom     

Thanks Michal

I got my reports working the way i wanted,

i had to mess around alot and the code looks like garbage, but hey it worked; thanks

Kód:

$opts['fdd']['SPC_ID'] = array(
  'name'     => 'SPC ID',
  'select'   => 'T',
  'options'  => 'AVCPDR', // auto increment
  'maxlen'   => 11,
  'default'  => '0',
  'sort'     => true
);

$opts['fdd']['SPC_Asset_User'] = array(
  'name'     => 'SPC Asset Name',
  'select'   => 'D',
  'maxlen'   => 20,
  'required' => true,
  'sql'    => 'Asset_Name',
  'sort'     => true,
);
$opts['fdd']['SPC_Software_Name'] = array(
  'name'     => 'SPC Software Name',
  'select'   => 'D',
  'maxlen'   => 30,
  'sort'     => true,
);
$opts['fdd']['SPC_Asset_Name'] = array(
  'name'     => 'SPC Asset User',
  'select'   => 'D',
  'maxlen'   => 20,
  'required' => true,
  'sort'     => true,
  'values'   => array(
    'table'       => 'Assets',
    'column'      => 'Asset_Name',
    'description' => 'Asset_User',
  )
);




?? Asset_User prints asset_name and asset_name prints asset_user ??

cheers

ned

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov