我想INNER JOIN
在SQL Server 2008中删除使用.
但我得到这个错误:
消息156,级别15,状态1,行15
关键字"INNER"附近的语法不正确.
我的代码:
DELETE FROM WorkRecord2
INNER JOIN Employee ON EmployeeRun=EmployeeNo
WHERE Company = '1' AND Date = '2013-05-06'
Run Code Online (Sandbox Code Playgroud) 我需要交叉表或数据透视表通过选择日期时间.
表文件TA
EmpNo ChkDate ChkIn
00001 2012-10-10 00:00:00.000 2012-10-10 07:22:00.000
00002 2012-10-10 00:00:00.000 2012-10-10 07:30:00.000
00001 2012-10-11 00:00:00.000 2012-10-11 07:13:00.000
00002 2012-10-11 00:00:00.000 2012-10-11 07:34:00.000
00001 2012-10-12 00:00:00.000 2012-10-12 07:54:00.000
00002 2012-10-12 00:00:00.000 2012-10-12 07:18:00.000
Run Code Online (Sandbox Code Playgroud)
我试过以下
SELECT tf.EmpNo,tf.ChkDate,tf.ChkIn
FROM (SELECT EmpNo,ChkDate,ChkIn
,ROW_NUMBER() OVER(PARTITION BY EmpNo ORDER BY ChkDate) as tfNum
FROM filesTA) AS tf
PIVOT(MIN(ChkDate) FOR tfNum IN ('2012-10-10'))
WHERE tf.ChkDate Between '2012-10-10' and '2012-10-12'
Run Code Online (Sandbox Code Playgroud)
但得到以下错误
Incorrect syntax near 'PIVOT'. You may need to set the compatibility
level of the …
Run Code Online (Sandbox Code Playgroud) 我生成数字8,9,A,B(Int64)
但是我需要
00000008
00000009
0000000A
0000000B
000001ED
本代码:
int count = 1;
sb = new StringBuilder();
sb.Append("SELECT max(Numb) FROM tblAs");
string sql = sb.ToString();
cmd.CommandText = sql;
cmd.CommandType = CommandType.Text;
cmd.Connection = Conn;
count = (int)cmd.ExecuteScalar();
int newCount = count;
int i;
for (i = 0; i < dataGridView1.Rows.Count; i++)
{
if (dataGridView1.Rows.Count > 0)
{
newCount = newCount + 1;
Int64 numTag;
string cTag = Convert.ToString(newCount);
numTag = Int64.Parse(cTag);
cTag = numTag.ToString("X");
if (cTag.Length < 8)
{
int countchar …
Run Code Online (Sandbox Code Playgroud) sql ×2
sql-server ×2
c# ×1
c#-4.0 ×1
crosstab ×1
datetime ×1
for-loop ×1
if-statement ×1
inner-join ×1
pivot ×1
sql-delete ×1
winforms ×1