Mysql LEFT JOIN多次

时间:2016-02-02 10:38:08

标签: mysql join

我跑:

SELECT 
  t2.n, t3.n, t4.n,... tn.n 
FROM t1 
  LEFT JOIN (SELECT ... FROM a LEFT JOIN b ON...) t2 ON t2.id = t1.c2 
  LEFT JOIN (SELECT ... FROM a LEFT JOIN b ON...) t3 ON t3.id = t1.c3 
  LEFT JOIN (SELECT ... FROM a LEFT JOIN b ON...) t4 ON t4.id = t1.c4
  ... 
  LEFT JOIN (SELECT ... FROM a LEFT JOIN b ON...) tn ON t4.id = t1.cn

括号中的所有内容都相同:

SELECT ... FROM a LEFT JOIN b ON...

我怎么称呼它而不是上述'n'次? t2.n,t3.n,t4.n,... tn.n具有不同的值

1 个答案:

答案 0 :(得分:0)

我没试过你可以试试下面的代码:

...
PdfDocument pdfDoc = PdfReader.Open(myUri.LocalPath, PdfDocumentOpenMode.Import);
PdfDocument pdfNewDoc = new PdfDocument();
for (int i = 0; i < pdfDoc.Pages.Count; i++)
{
   PdfPage page = pdfNewDoc.AddPage(pdfDoc.Pages[i]);
   XFont fontNormal = new XFont("Calibri", 10, XFontStyle.Regular);    
   XGraphics gfx = XGraphics.FromPdfPage(page);
   var xrect = new XRect(240, 395, 300, 20);
   var rect = gfx.Transformer.WorldToDefaultPage(xrect);
   var pdfrect = new PdfRectangle(rect);

   //file link
   page.AddFileLink(pdfrect, myUri.LocalPath);
   //web link
   //page.AddWebLink(pdfrect, myUri.AbsoluteUri);


   gfx.DrawString("MyFileName", fontNormal, XBrushes.Black, xrect, XStringFormats.TopLeft);
}
pdfNewDoc.Save(myDestinationUri.LocalPath + "MyNewPdfFile.pdf");
...