SQL Help必需 - 查询包含前一天添加的所有用户

时间:2016-06-26 07:07:12

标签: sql sql-server

给出以下SQL查询:

W = tf.Variable(tf.zeros([22, 5])) # can try better initialization methods
b = tf.Variable(tf.zeros([5])) # can try better initialization methods
y = tf.matmul(x, W) + b

loss = tf.reduce_mean(
   tf.nn.softmax_cross_entropy_with_logits(y, y_)
)

train_step = tf.train.GradientDescentOptimizer(0.5).minimize(loss)

能告诉我如何获得

的结果
  

报告包含前一天添加的所有用户

在这里,我想知道在&#34; creationDate&#34;上创建SELECT * FROM TableName WHERE creationDate >= GetDate() -1 AND creationDate < GetDate() 子句。昨天的专栏,例如:

WHEREDD:MM:YYYY:12:01:00 (AM)

我是SQL的新手,请帮助我。

2 个答案:

答案 0 :(得分:0)

如果您想获取前一天的所有记录,可以使用dateadddatediff函数执行以下操作:

SELECT users 
FROM "yourTable"
WHERE Createddate >= dateadd(day,datediff(day,1,GETDATE()),0)
    AND Createddate < dateadd(day,datediff(day,0,GETDATE()),0)

如果您有日期范围,则可以使用between功能执行此操作:

SELECT users FROM "yourTable"
WHERE Createddate between "yourFirstDate" and "yourSecondDate"

或者你可以这样做:

SELECT users FROM "yourTable"
WHERE Createddate = "yourDate"

答案 1 :(得分:-1)

更优化的方法:

    Button new_button = (Button) findViewById(R.id.Button);
    //now we gotta set up the event listener
    new_button.setOnClickListener(
            //here we will put call back method,
            //after someone click the button
            //this methods's body get's executed
            //this is interface
            new Button.OnClickListener(){
                public void onClick(View v){
                    TextView Text = (TextView) findViewById(R.id.Text);
                    Text.setText("YOU PRESSED IT!");
                }
            }
    );
    new_button.setOnClickListener(
            new Button.OnClickListener(){
                public void onClick(View v){
                    TextView Text = (TextView) findViewById(R.id.Text);
                    Text.setText("Please don't press it again :)");
                }
            }
    );
    new_button.setOnClickListener(
            new Button.OnClickListener(){
                public void onClick(View v){
                    TextView Text = (TextView) findViewById(R.id.Text);
                    Text.setText("You Pressed it again! >:{");
                }
            }
    );
    new_button.setOnClickListener(
            new Button.OnClickListener(){
                public void onClick(View v){
                    TextView Text = (TextView) findViewById(R.id.Text);
                    Text.setText("Stop Pressssssing It");
                }
            }
    );
    new_button.setOnClickListener(
            new Button.OnClickListener(){
                public void onClick(View v){
                    TextView Text = (TextView) findViewById(R.id.Text);
                    Text.setText("Please Stop It!");
                }
            }
    );