SQL запрос для получения данных с несколькими условиями

Я не вижу, где вы объявляете context. С целью создания намерения вы можете использовать MainActivity.this

 lv.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position,
                    long id) {
                Intent intent = new Intent(MainActivity.this, SendMessage.class);
                String message = "abc";
                intent.putExtra(EXTRA_MESSAGE, message);
                startActivity(intent);
            }
        });

. Чтобы получить объект после нажатия, вы можете использовать AdapterView:

ListEntry entry = (ListEntry) parent.getItemAtPosition(position);
-2
задан asinha 6 March 2019 в 12:08
поделиться

7 ответов

Вы можете сделать:

select t.*
from table t
where t.c = 0 and
      not exists (select 1 from #tm t1 where t1.a = t.a and t1.c < 0) 
0
ответ дан Yogesh Sharma 6 March 2019 в 12:08
поделиться

Вы можете использовать group by и having:

select a
from t
group by a
having min(c) = 0 and max(c) = 0;
0
ответ дан Gordon Linoff 6 March 2019 в 12:08
поделиться

С NOT EXISTS:

select distinct a from tablename t
where not exists (
  select 1 from tablename 
  where 
    a = t.a
    and
    c <> 0
)
0
ответ дан forpas 6 March 2019 в 12:08
поделиться

Попробуйте это:

 Select 
 A
 from #tmp
 group by A 
 Having 
 count(*)=count(case when c=0 then 0 else null end)
0
ответ дан Baloch 6 March 2019 в 12:08
поделиться

Попробуйте это:

select distinct A from [dbo].[table] where A not in ( select A from [dbo].[table] where C <> 0)

0
ответ дан Anna 6 March 2019 в 12:08
поделиться

Вы можете проверить среднее значение C, если оно равно 0, тогда все значения C равны нулю для B,

SELECT A 
FROM table
GROUP BY A
HAVING SUM(ABS(C))=0
0
ответ дан Ajan Balakumaran 6 March 2019 в 12:08
поделиться

Для SQL Server:

SELECT A FROM ta
EXCEPT
SELECT A FROM ta WHERE C <> 0
0
ответ дан onedaywhen 6 March 2019 в 12:08
поделиться
Другие вопросы по тегам:

Похожие вопросы: