Reputation:
I have a Two tables. Names are tbl_Module_Contact and tbl_Module_Contact_Details.
Now,tbl_Module_Contact ----> Columns are ----> ContactID, CategoryID, TypeID, CustomerID, Status all Numeric
Now, second Table tbl_Module_Contact_Details----> Columns are -----> RecordID, ContactID, LanguageID, Keywords, Icon, LocationName, Logo here Ico, LocationName ,Logo and Keywords String typesand all others are Numeric
Now what i want is. Create a Query Using INNER JOIN. I want to fetch all the data from tbl_Module_Contact_Details where status=1
and keyword
,categoryID
and LanguageID
that i have passed and also Logo name
ends with .jpg
or .png
and at last Order by LocationName
.
Upvotes: 1
Views: 53
Reputation: 47817
First Open()
your DB
and Execute the below query
Cursor mCursor = db
.rawQuery(
"SELECT * FROM tbl_Module_Contact_Details INNER JOIN tbl_Module_Contact ON tbl_Module_Contact_Details.ContactID=tbl_Module_Contact.ContactID and tbl_Module_Contact_Details.LanguageID='"
+ LanguageID
+ "' and tbl_Module_Contact.CategoryID='"
+ CategoryID
+ "' and tbl_Module_Contact.Status=1 Where Keywords like '%"
+ searchword
+ "%' and (Logo like '%.jpg' OR Logo like '%.png') order by LocationName ",
null);
if (mCursor != null) {
mCursor.moveToFirst();
}
Here in this Query you need to pass LanguageID
,CategoryID
and searchword
.All the data coming into the Cursor
fetch it and used it.
Try this Query
and give me feedback on this
Upvotes: 1