我有两张桌子
表A
Number
111
222
333
444
Run Code Online (Sandbox Code Playgroud)
表B
Number Another
111 AAA
222 BBB
666 CCC
777 DDD
Run Code Online (Sandbox Code Playgroud)
我想做的是应用一个UPDATE语句,条件是表A中是否存在表B中的“ Number”值。因此,该表最终看起来像这样。
Number Another
111 ZZZ
222 ZZZ
666 CCC
777 DDD
Run Code Online (Sandbox Code Playgroud)
我知道我需要使用UPDATE查询和可能的某种JOIN,但是我不确定语法。
任何帮助,不胜感激。
我正在使用http://validator.w3.org来验证我的代码.
但是我有45个错误,主要与重复的id有关.
我认为在可能的情况下重新使用CSS将是一个很好的尝试.
示例代码:
CSS
#cloudbullet {
background-color: #85c0bf;
height: 22px;
left: 13px;
margin-top: 7px;
position: relative;
top: 63px;
width: 20px;
Run Code Online (Sandbox Code Playgroud)
HTML
<div id="container1-title" class="">
<h2>Cloud/Hosting</h2>
</div>
<div id="cloudbullet" class="">
</div>
<div id="cloudbullet" class="">
</div>
<div id="cloudbullet" class="">
</div>
<div id="cloudbullet" class="">
</div>
<div id="cloudbullet" class="">
</div>
<div id="cloudbullet" class="">
</div>
Run Code Online (Sandbox Code Playgroud)
结果是我在垂直行中得到6个css框.
请有人建议我所做的是否正确,是否应该忽略验证或是否需要以不同的方式完成?
谢谢,
我有以下代码来检查我的表是否存在,然后再继续
If ds.Tables(3).Rows.Count = 0 Then
MsgBox("Nothing!!!!")
Else
DataGridView1.DataSource = ds.Tables(3)
Run Code Online (Sandbox Code Playgroud)
问题是我不断收到错误“找不到表 3”。
在VB中我如何检查表是否存在,而不是我的应用程序出错,我只是希望它在表不存在时不执行任何操作。
我也尝试过
If ds is nothing
Run Code Online (Sandbox Code Playgroud)
非常感谢任何帮助。
我正在尝试将列中的一些值连接到单个字段中。
到目前为止我有以下代码。
SELECT DISTINCT [customer id]
,[customer name]
,STUFF( (SELECT ',' + [description]
FROM [Invoicing].[dbo].[CurrentBillMaster]
ORDER BY [description]
FOR XML PATH('')),
1, 1, '')
,[id]
,[Section]
,[customerpo]
FROM [Invoicing].[dbo].[CurrentBillMaster]
GROUP BY [customer id], [customer name], [description],[qty],
[identifier],[FromDate],[ToDate],[id],[Section],[customerpo]
Run Code Online (Sandbox Code Playgroud)
该代码基本上可以工作,但是我想要串联的描述,只是为了显示该唯一的[客户 ID] 的描述
非常感谢任何帮助
我试图运行以下代码将一些数据插入到我的表中.
它在没有WHERE语句的情况下工作正常,但是当我尝试仅插入"语音呼叫"值时,它会在语法上出错.我认为这是因为使用WHERE我必须有一个SELECT语句,但我不确定SQL需要什么样子
Dim strSql As String =
"INSERT INTO [" + FileNameOnly + "] (Account,[From],[To],Country,[Description],ConnectTime,ChargedTime,ChargedTimeSecs,ChargedAmount,ServiceName,ChargedQuantity,ServiceUnit)
VALUES(@Account,@From,@To,@Country,@Description,@ConnectTime,@ChargedTime,@ChargedTimeSecs,@ChargedAmount,@ServiceName,@ChargedQuantity,@ServiceUnit)
WHERE [ServiceName] = 'Voice Calls' "
Run Code Online (Sandbox Code Playgroud)
任何帮助非常感谢.
谢谢,
我使用下面的代码在我的SQL dB中插入日期,但我一直收到错误.
"操作数类型冲突:int与日期不兼容"
这是我的代码:
Using cmdb = New SqlCommand("INSERT INTO Tarrifs (Tarrif, Created_Date) VALUES (@tarrif2, @DateTime)", con)
con.Open()
cmdb.Parameters.AddWithValue("@tarrif2", TextBox1.Text)
cmdb.Parameters.AddWithValue("@DateTime", SqlDbType.Date)
cmdb.ExecuteNonQuery()
con.Close()
End Using
End Using
Run Code Online (Sandbox Code Playgroud)
我认为这是因为SQL将其作为文字字符串而不是日期来读取.
任何人都可以帮助正确的语法吗?
任何帮助非常感谢
请有人帮我理解,为什么当我运行下面的SQL代码时它会返回一个"s".但是,当我自己运行SQL部分时,它返回正确的值"DaisyRates_May2014"
完整代码:
DECLARE @tablevalue varchar
SET @tablevalue = 'select distinct [BillingReferenceData].[dbo].[Customers].[Tariff]
from [daisybilling].[dbo].[APRW14_FFA68878_Calls]
inner join [BillingReferenceData].[dbo].[Customers] on [DaisyBilling].[dbo].[APRW14_FFA68878_Calls].[Customer Lookup] = [BillingReferenceData].[dbo].[Customers].[Customer ID]
where [DaisyBilling].[dbo].[APRW14_FFA68878_Calls].[Customer Lookup] = [BillingReferenceData].[dbo].[Customers].[Customer ID]'
Select @tablevalue
Run Code Online (Sandbox Code Playgroud)
SQL本身:
'select distinct [BillingReferenceData].[dbo].[Customers].[Tariff]
from [daisybilling].[dbo].[APRW14_FFA68878_Calls]
inner join [BillingReferenceData].[dbo].[Customers] on [DaisyBilling].[dbo].[APRW14_FFA68878_Calls].[Customer Lookup] = [BillingReferenceData].[dbo].[Customers].[Customer ID]
where [DaisyBilling].[dbo].[APRW14_FFA68878_Calls].[Customer Lookup] = [BillingReferenceData].[dbo].[Customers].[Customer ID]
Run Code Online (Sandbox Code Playgroud)
谢谢
sql ×5
sql-server ×3
vb.net ×2
case ×1
css ×1
dataset ×1
for-xml-path ×1
html ×1
if-statement ×1
sql-update ×1
syntax ×1
t-sql ×1
validation ×1
variables ×1
w3c ×1