从表中选择列后进行自我联接

时间:2019-08-29 13:35:28

标签: mysql sql

我想从表中选择两列。在这2个选定的列上,我要进行自我连接(交叉)。

我尝试了几次查询,但是给了我错误: table1 does not exists

select a.day day
     , b.id as id table1 a 
 cross 
  join table1 b 
 where a.id <> b.id 
   and table1 in (select id
                          , `day` 
                       from original_table 
                      where `day` = '2019-08-01');

预期结果是id的交叉连接。

2 个答案:

答案 0 :(得分:1)

您缺少from子句,并且In的条件不正确

// Check we have a value as well
Yup.number().test('len', 'Must be exactly 5 characters', val => val && val.toString().length === 5 )

答案 1 :(得分:1)

您必须在条件中提及列名

<label>
    <input type="checkbox" />
</label>