在多表连接查询中返回ROWID而不是数值

huangapple go评论53阅读模式
英文:

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;

huangapple
  • 本文由 发表于 2023年4月7日 05:33:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75953951.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定