MySQL Forums
Forum List  »  MySQL Workbench

Select isn't returning the correct data
Posted by: Juan Ignacio Fabre
Date: January 30, 2018 05:09PM

In the place where i'm working i've been asked to get a list of all the customers who have bought one of our courses for administrative purposes. Thing is, the transactions and user data are held in 2 separate tables.
The transactions table includes date of the transaction, the course bought, how long does the membership last, how much was paid, etc, and it has an user_id column which holds the id of the user that made that particular transaction.
At first i wanted to filter all those with a temporary free membership and cross the user_id column in transactions with de id column in users but as i didn't know how to word such a query i settled on writing by hand all of the users ids in a simple query on the users table to get all of those who paid.
The problem is that for some reason the query does not only return the rows with the ids that i metioned on the query, but the whole table. I'm writing about 380 IDs and I get upwards of 700 users. I'm gonna paste the query as I wrote it below and I would really aprecciate if someone could tell me the problem.

SELECT * FROM vstore_vulcano_monserrat.acad_usuarios WHERE id = '3' or
'11' or
'20' or
'21' or
'22' or
'25' or
'26' or
'28' or
'43' or
'44' or
'45' or
'46' or
'47' or
'48' or
'49' or
'50' or
'52' or
'58' or
'59' or
'60' or
'64' or
'88' or
'89' or
'98' or
'120' or
'121' or
'122' or
'123' or
'131' or
'135' or
'136' or
'140' or
'141' or
'142' or
'143' or
'144' or
'145' or
'146' or
'147' or
'148' or
'149' or
'150' or
'155' or
'156' or
'157' or
'170' or
'182' or
'186' or
'187' or
'203' or
'204' or
'205' or
'207' or
'211' or
'212' or
'213' or
'221' or
'222' or
'223' or
'225' or
'226' or
'227' or
'228' or
'230' or
'231' or
'232' or
'233' or
'234' or
'235' or
'241' or
'242' or
'244' or
'245' or
'246' or
'247' or
'248' or
'249' or
'287' or
'303' or
'304' or
'305' or
'306' or
'307' or
'308' or
'309' or
'310' or
'311' or
'312' or
'313' or
'314' or
'315' or
'316' or
'317' or
'318' or
'319' or
'320' or
'321' or
'322' or
'324' or
'326' or
'327' or
'328' or
'329' or
'330' or
'331' or
'332' or
'333' or
'334' or
'335' or
'336' or
'337' or
'338' or
'339' or
'340' or
'341' or
'342' or
'343' or
'345' or
'346' or
'347' or
'349' or
'355' or
'371' or
'372' or
'373' or
'374' or
'375' or
'376' or
'378' or
'379' or
'380' or
'381' or
'385' or
'386' or
'400' or
'402' or
'406' or
'407' or
'413' or
'414' or
'415' or
'416' or
'417' or
'418' or
'419' or
'426' or
'434' or
'437' or
'438' or
'439' or
'440' or
'442' or
'443' or
'444' or
'446' or
'448' or
'449' or
'452' or
'458' or
'510' or
'511' or
'512' or
'515' or
'521' or
'536' or
'571' or
'637' or
'684' or
'697' or
'708' or
'717' or
'724' or
'725' or
'727' or
'734' or
'735' or
'738' or
'739' or
'740' or
'759' or
'761' or
'762' or
'764' or
'765' or
'766' or
'767' or
'768' or
'781' or
'784' or
'786' or
'787' or
'788' or
'789' or
'805' or
'807' or
'817' or
'819' or
'820' or
'822' or
'824' or
'825' or
'830' or
'840' or
'846' or
'851' or
'856' or
'862' or
'866' or
'879' or
'880' or
'881' or
'882' or
'885' or
'887' or
'906' or
'909' or
'910' or
'911' or
'913' or
'965' or
'966' or
'967' or
'975' or
'993' or
'994' or
'1004' or
'1008' or
'1009' or
'1011' or
'1014' or
'1019' or
'1023' or
'1057' or
'1068' or
'1110' or
'1114' or
'1118' or
'1127' or
'1129' or
'1133' or
'1138' or
'1145' or
'1161' or
'1164' or
'1166' or
'1172' or
'1188' or
'1198' or
'1199' or
'1203' or
'1204' or
'1205' or
'1221' or
'1238' or
'1239' or
'1249' or
'1252' or
'1253' or
'1256' or
'1261' or
'1304' or
'1321' or
'1333' or
'1336' or
'1348' or
'1353' or
'1363' or
'1364' or
'1366' or
'1368' or
'1369' or
'1375' or
'1380' or
'1382' or
'1384' or
'1422' or
'1425' or
'1426' or
'1429' or
'1435' or
'1438' or
'1443' or
'1445' or
'1470' or
'1471' or
'1476' or
'1478' or
'1491' or
'1497' or
'1516' or
'1517' or
'1525' or
'1526' or
'1532' or
'1533' or
'1536' or
'1537' or
'1541' or
'1544' or
'1545' or
'1547' or
'1551' or
'1552' or
'1553' or
'1555' or
'1556' or
'1557' or
'1559' or
'1562' or
'1563' or
'1568' or
'1570' or
'1572' or
'1574' or
'1575' or
'1603' or
'1605' or
'1613' or
'1615' or
'1618' or
'1620' or
'1632' or
'1634' or
'1637';

Options: ReplyQuote


Subject
Views
Written By
Posted
Select isn't returning the correct data
237
January 30, 2018 05:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.