php - need assistance creating sql query with two IN statements -


i need query has 2 in() statements inside it.

of course following totally wrong, it's sort of i'm looking for:

<?php $query = mysql_query("select 1.field1, 1.field3, m.field2 table 1, table2 2 1.field1=2.field2 , 1.field3 in (0,1)and 1.field2 in (5,2)) or die(mysql_error()); ?> 

$query = mysql_query("     select a.field1,            a.field3,            a.field2       table a,            table2 b      a.field1=b.field2            , a.field3 in (0,1)            , a.field2 in (5,2)") or die(mysql_error()); 

should work. it's worth noting you're using old-style join syntax (ansi-89) newer standard ansi-92 has been out 2 decades , should start using it...

$query = mysql_query("     select a.field1,            a.field3,            a.field2       table            inner join table2 b                on a.field1=b.field2      a.field3 in (0,1)            , a.field2 in (5,2)") or die(mysql_error()); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -