英文:
Returning ROWID instead of a value in a multi join query
问题
SELECT TableA.PK AS ID, ROWID() AS ROW_ID
FROM TableA
LEFT JOIN TableB ON TableB.StringValue = TableA.StringValue;
英文:
I am interested in returning the ROWID of a LEFT JOIN table and I am not sure how to structure the SELECT for this. The LEFT JOIN table has string values and no primary key.
For example: TableA has a StringValue FK into TableB
TableA (PK,StringValue)
TableB (StringValue)
SELECT TableA.PK AS ID, **ROWID TableB??**
FROM TableA
LEFT JOIN TableB ON TableB.StringValues = TableA.StringValues;
I tried multiple ways to call ROWID but nothing was returned.
答案1
得分: 0
以下是翻译好的部分:
这是我用来在需要的调用表单中获取另一个表单中的一个ID的方法。抱歉,我不使用连接(join),但一旦你有了这两个ID,你就可以进行连接操作。
调用值是udID,返回值是newData。
public void GetID(int udID)
{
newData = udID;
return;
}
英文:
Here is a method I use to get one ID in another form that I need for the calling form. Sorry I do not use join but once you have both ID's can you then join
The calling value is udID the return value is newData
public void GetID(int udID)
{
newData = udID;
return;
}
答案2
得分: 0
可以使用类似以下的方式来实现:
SELECT a.PK AS ID, b.rowid
FROM TableA a
LEFT JOIN TableB b ON b.StringValue = a.StringValue;
英文:
You can do it using something like this :
SELECT a.PK AS ID, b.rowid
FROM TableA a
LEFT JOIN TableB b ON b.StringValue = a.StringValue;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论