Table1

ID Name City ContactNo
GK12-350 - Peter - Munich - 8997557906
EG24-812 - Colling - London - 8726 6000
RU38-915 - Brezhnev - Moscow - 4958721273

Table2

ID OderFrom OrderDate AprovedBy
EG24-812 - City Saloon - 23-03-2012 - Thomas
RU38-915 - General Merchants - 01-07-2011 - Rumpe
EG24-812 - Out Fitting Co. - 23-05-2012 - Odvilose
GK12-350 - General Merchants - 12-08-2012 - Thomas

Here is my Database tables, I use VB.Net

Textbox1.text Used to “Name”
Textbox2.text Used to “AprovedBy”

I use this code to Search,

Dim StrQ As String = "Select Table1.ID, Tabel1.Name, Table1.City, Table1.ContactNO from Table1 INNER JOIN Table2 on Table2. ID=Tabe11.ID where Table1.Name like  '%" & TextBox1.Text & "%' and Table2.AprovedBy like  '%" & TextBox2.Text & "%' order by Name"

If I enter “Co” to Name Search Box,
It shows like this (Two Times shows same Name)

EG24-812 - Colling - London - 8726 6000
EG24-812 - Colling - London - 8726 6000

I need like this result

EG24-812 - Colling - London - 8726 6000

Please show me how to do this,

Recommended Answers

All 4 Replies

Have you tried select distinct? That's just a thought, off the top.

Sorry Sir, I am not understand what you mean

Sir, I tried it and Its work, thank for you instruction, before I not realy thought about "Select Distinct", Thank You..

Glad to help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.