如何使用php查找一个表的不同值id是否退出到另一个表。
例如:让table1
拥有id
(非主要或唯一)4
,5
,6
,4
,{{ 1}},如何检查6
的{{1}}是否有id
,table2
,4
?
5
答案 0 :(得分:0)
这个SQL可能会有所帮助:
int rowCount = xlRange.Rows.Count;
int colCount = xlRange.Columns.Count;
Excel.Range cell = null;
for (int iRow = 1; iRow < rowCount; iRow++)
{
for (int iCol = 1; iCol <= colCount; iCol++)
{
/* This line of code is probably wrong */
cell = xlRange.Cells[iRow, iCol] as Excel.Range;
if(/*Cell contains PivotTable*/)
{
int rowLocation = iRow;
int colLocation = iCol;
}
}
}
答案 1 :(得分:0)
SELECT table2.id
FROM table2
WHERE table2.id IN (
SELECT DISTINCT table1.id
FROM table1
)
答案 2 :(得分:0)
要获取table1中作为table2中的id的所有项目代码的列表: -
SELECT DISTINCT table1.project_code
FROM table1
INNER JOIN table2
ON table1.project_code = table2.id
从table1获取表2中所有项目代码的列表
SELECT DISTINCT table1.project_code
FROM table1
LEFT OUTER JOIN table2
ON table1.project_code = table2.id
WHERE table2.id IS NULL
如果您想要的2上的条目不在1
SELECT DISTINCT table2.id
FROM table2
LEFT OUTER JOIN table1
ON table1.project_code = table2.id
WHERE table1.project_code IS NULL