答案 0 :(得分:1)
你可能需要自我加入
select a.customerId, a.CustomerName, a.BillToCustomerId, b.CustmerName
from my_table a
inner join my_table b on a.BillToCustomerId = b.customerId
答案 1 :(得分:1)
只需在表上自行加入并为该CustomerName提供别名
CREATE TABLE [dbo].[Table](
[Id] [uniqueidentifier] NOT NULL,
[BatchNumber] [nvarchar](max) NULL,
[JobType] [nvarchar](max) NULL,
[Operator] [nvarchar](max) NULL,
[TransactionNumber] [int] NULL,
[Status] [nvarchar](100) NULL,
[CreatedOn] [datetime] NOT NULL,
[ModifiedOn] [datetime] NOT NULL,
答案 2 :(得分:0)
似乎你需要subquery
:
select c.*,
(select c1.CustomerName
from Customer c1
where c1.BillToCustomerId = c.BillToCustomerId
order by c1.customerid
limit 1
) as BilltoThisCompany
from Customer c;
答案 3 :(得分:0)
<?php
$data = $_REQUEST;
$user_text = $_REQUEST['user_text'];
$response = strtoupper($user_text);
echo $response;
?>