How to find an exact match in a Access DB table using Sql Query in VB6 ?
I know that "Like" keyword will give out all those rows which contain the search-for-string.
But I want exact match. Can anyone help me please ?
How to find an exact match in a Access DB table using Sql Query in VB6 ?
I know that "Like" keyword will give out all those rows which contain the search-for-string.
But I want exact match. Can anyone help me please ?
Use = sign.
SELECT * FROM tablename WHERE ID=1;
Other operators:
<
>
<=
=>
<>
Is Null
Not
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
My search-for-string is a sub-string in a column.
Say, my column is like this.
25, 32
24, 31, 58
32, 14
56, 322
And say i search for 32.
The rows to be returned are : only 1 and 3 and not row # 4 (because it just contain the "32" and it is not equal to 32)
This is how it can be done ....
Code:vStr1 = Chr(32) 'Space vStr2 = "," vSql = "Select * from 1RecMast where IDs like '%" & vStr1 + txtID.Text & "%' or Trim(IDs) like '%" & txtID.Text & "%' or IDs like '%" & txtID.Text + vStr2 & "%'"
Multiple values in one field - not a normalized data structure.
I don't see how that SQL excludes row 4.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.