Hi! I have multi table. But I want search data from all.
DECLARE @Fruits AS TABLE(Id INT,Name VARCHAR(10),Price INT)
INSERT INTO @Fruits VALUES(1,'Apple',5)
INSERT INTO @Fruits VALUES(2,'Orange',13)
INSERT INTO @Fruits VALUES(3,'Oil',25)
INSERT INTO @Fruits VALUES(4,'Cherry',12)
DECLARE @Person AS TABLE(Id INT,Person VARCHAR(10),IdFood VARCHAR(50),NumberKg VARCHAR(50))
INSERT INTO @Person VALUES(1,'Rustam','1,2,4','2,3,1')
INSERT INTO @Person VALUES(2,'Firuzjon','2,3,1,4','1,1,1,1')
INSERT INTO @Person VALUES(3,'Sadriddin','4','3')
DECLARE @Cars AS TABLE(Id INT,Car VARCHAR(10),Price INT)
INSERT INTO @Cars VALUES(5,'musso',500)
INSERT INTO @Cars VALUES(6,'mersedes',700)
INSERT INTO @Cars VALUES(7,'tayota',300)
declare @var varchar(10) = 'charry'
select f.Name,p.Person,c.Car from @Fruits f inner join @Person p on p.Id=f.Id join @Cars c on p.Id=c.Id where Name = @var or Person = @var or Car = @var
Output result: