How to find common rows in two sets of query results?
Right now I have two string queries:
SELECT * FROM hmdb WHERE shamsidate MATCH '1376/05/24 1385/11/12'
and,
SELECT * FROM hmdb WHERE hmdb MATCH 'content:red OR keyword:red v_other:true'
and this is the way I show the results of each one:
public void searchRecords()
{
SQLiteConnection m_dbConnection;
m_dbConnection = new SQLiteConnection("Data
Source=hmdb.sqlite;version=3;");
try
{
m_dbConnection.Open();
SQLiteDataAdapter db = new SQLiteDataAdapter(queryString,
m_dbConnection);
DataTable dt = new DataTable("hmdb");
db.Fill(dt);
listView1.ItemsSource = dt.DefaultView;
}
catch (Exception e)
{
string ex = e.ToString();
System.Windows.MessageBox.Show(ex);
}
finally
{
if (m_dbConnection != null)
{
m_dbConnection.Close();
m_dbConnection.Dispose();
}
}
}
Now, I wanted to know how can I get the common rows in both of these
queries in order to show them in my listView; or better yet, is there a
way to do just one query and get the desired result?
No comments:
Post a Comment