Jump to content

search a record in 2 fields


Guest shivani
 Share

Recommended Posts

Guest shivani

hialli want a help for query which i need 2 search a recordi a using access db. the 2 tables contains following fields1. sno ven_dor nature emp_no2 sno1 problem desc ven_dor1 emp_no1now wat i want to search for employee no. the both tabels can have same employee no. i m using query like thisSELECT * FROM data, data1 WHERE (sno=sno1 ven_dor=ven_dor1) AND emp_no OR emp_no1 like ?";i m getting all other record other than wat i have entered.can anybody plz help me outregardsshivani

Link to comment
Share on other sites

What you do you mean you are getting all records other than what you have entered? If you are trying to search 2 database tables as one they should have the same structure, which they appear to, and then you should utelize the MySQL merge type so that you can then just create one simply query.

Link to comment
Share on other sites

hi try this code and it get all recored

<%Dim conn            Dim rs  Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/tst.mdb"))set rs = Server.CreateObject("ADODB.recordset") sql= "SELECT name FROM data, data1 WHERE 'sno = sno1 ' AND 'ven_dor = ven_dor1' AND 'name like ? '"set RS = Conn.Execute(SQL)do until rs.EOF    for each x in rs.Fields Response.Write(x.value ) Response.Write(x.name & "<br />")     next      rs.MoveNextlooprs.closeconn.close%>
this is the result samerenamesamerenamemohdnamemohdnamei have just 2 field and it is get the both field
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...