Avatar of mokatell
mokatell
 asked on

mysql .. retrieving if true ..

+-------+-----------+----------
| appID | empid | finished
+-------+-----------+----------
|     5 |         2 |        1
|     5 |         5 |        0
|     5 |         6 |        0
|     9 |         3 |        0
|     9 |         6 |        0
|    21 |         3 |        0
|    21 |         6 |        0
|    21 |         7 |        0
|    21 |         4 |        0
|    26 |         2 |        0
|    26 |         4 |        0
|    26 |         6 |        0
|    22 |         4 |        1
|    22 |         5 |        1
|    22 |         6 |        1
|    22 |         3 |        1
|    22 |         7 |        1
|    20 |         2 |        0
|    11 |         0 |        0
|     8 |         5 |        0
|     8 |         3 |        0
|     4 |         2 |        1
|     4 |         6 |        0
|     7 |         5 |        1
|     7 |         6 |        1
|     7 |         2 |        1
|     6 |         5 |        1
|     6 |         3 |        0
|     6 |         7 |        1

for example ...
in this table ... i wanna get all the appid where its ALL relavent finished column is '1'
MySQL Server

Avatar of undefined
Last Comment
max2jhonny

8/22/2022 - Mon
max2jhonny

which of the columns are to be considered as relevent , you can just select the columns where finished is 1

select *  from <table_name> where finished = '1'
mokatell

ASKER
no , ... i know that this is very simple ..
for example ..
i wanna a query that gives me back

appID
---------
7
22

because ALL their relvant columns are '1' ... got me now !??
systan

select appID, finished  from <table_name> where finished = '1'
or
select DISTINCT appID, finished  from <table_name> where finished = '1'
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
mokatell

ASKER
this is not what i want ..
because on what u hace said will also include appID 6 , 5  and 4 ... but i want only 7 & 22 becasue 7 and 22 all the finished columns for them is '1'.......

my question is very clear ..
ASKER CERTIFIED SOLUTION
max2jhonny

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
mokatell

ASKER
fine ..now i got the finished apps

how can i mix your query with this one :

this query reads from two tables --->

select t1.appid,t1.username,t2.fax from account_information t1 join personal_information t2 on t1.appID= t2.appID ;
max2jhonny

select t1.appid,t2.fax,t1.finished from example t1 join example1 t2 on t1.appID= t2.appID
where t1.finished = '1' and t1.appid NOT IN (select distinct appid from example where finished = '0');
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.