Description:
I have a .csv file named namespgf.csv
Reg.No.,Name
5501,Kathirvelu A
5502,Gugan K
5503,Kalaitchelvi S
5504,Suresh S
5505,Mahesh K
and another .csv file named markspgf.csv
number,marks
5501,67
5502,25
5503,62
5505,95
Pl. note that the register number 5504 is not there in markspgf.csv.
Now I try to copy the marks column to the namespgf.csv file and typeset a table like this (This is what I want):
Reg.No. Name marks
5501 Kathirvelu A 67
5502 Gugan K 25
5503 Kalaitchelvi S 62
5505 Mahesh K 95
Here, the candidate with register number 5504 has no marks in `markspgf.csv. I want to omit the entry corresponding to that number from my resulting table as above. But this is what I get in my attempt:

Here is the code (MWE) that produces the table:
\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{filecontents}
%
\begin{filecontents}{namespgf.csv}
Reg.No.,Name
5501,Kathirvelu A
5502,Gugan K
5503,Kalaitchelvi S
5504,Suresh S
5505,Mahesh K
\end{filecontents}
%
\begin{filecontents}{markspgf.csv}
number,marks
5501,67
5502,25
5503,62
5505,95
\end{filecontents}
\begin{document}
%=============================================================================
\pgfplotstableread[col sep=comma]{namespgf.csv}\namespgf
\pgfplotstableread[col sep=comma,verb string type]{markspgf.csv}\markspgf
%
\pgfkeys{/pgfplots/table/verb string type}
% ----------------------------------------------------------------------%
\pgfplotstablecreatecol[copy column from table={\markspgf}{[index] 1},skip first n=1] {marks} {\namespgf}
%
{\centering
\pgfplotstabletypeset[columns={Reg.No.,Name,marks}
]{\namespgf}
}
%
\end{document}
The question:
How to omit the entry corresponding to Reg. No. 5504 and put the correct marks in front of Reg. No. 5505? (How to get the table as I explained above)?
Please note that I want a solution using pgfplotstable. The main reason behind this is the size of the data I am dealing with. With this amount of data, datatool takes light years to compile and some times, pdflatex runs out of memory. But pgfplotstable is fast and and memory efficient.


namespgf.csvfile considered to be complete? i.e., is it guaranteed that every entry inmarkspgf.csvexists innamespgf.csv. Also, is there a typo in themarkspgf.csvfile created byfilecontentsas it does not match the description given earlier? – Peter Grill Jul 27 '12 at 6:34pgfplotstablehas no built-in support for table joins. That said, you could certainly write more-or-less sophisticated join implementations (either using linear search as in Peter Grills answer or indexed search as in Scott's answer). Note that table joins have very good implementations in SQL DBs. A ready-to-use example might be SQLLite. Are you sure you want to do that in TeX? – Christian Feuersänger Jul 28 '12 at 9:22