<div>Hi Robbie,</div>
<div>Thanks for reply.</div>
<div> </div>
<div>This will work , but it will give employess who has either PHP or Java skill or both.</div>
<div> </div>
<div>What I wanted is , result should give employess having both PHP and Java skill.</div>
<div> </div>
<div>I figured it out, the syntax should be as below.</div>
<div><br>SELECT EmployeeID <br>FROM `table` <br>WHERE `skill` IN ('PHP','Java')<br>GROUP BY EmployeeID<br>HAVING COUNT(*) = 2</div>
<div> </div>
<div>This query's result gives employee ids who has both PHP and Java skills.</div>
<div> </div>
<div>The link <a href="http://stackoverflow.com/questions/4049650/what-sql-query-for-multiple-rows-with-one-value-the-same-in-each">http://stackoverflow.com/questions/4049650/what-sql-query-for-multiple-rows-with-one-value-the-same-in-each</a> was really helpful.</div>
<div> </div>
<div>Thanks a lot for helping me.<br><br>Regards</div>
<div>Austin.</div>
<div> </div>
<div> </div>
<div class="gmail_quote">On Sat, Apr 16, 2011 at 5:17 PM, Robbie The Geek <span dir="ltr"><<a href="mailto:robbiethegeek@gmail.com">robbiethegeek@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote"><br>SELECT EmployeeID FROM {tablename} WHERE Skill IN ( 'PHP', 'Java');<br><br><br>
<div>----- Reply message -----<br>From: "Austin Einter" <<a href="mailto:austin.einter@gmail.com" target="_blank">austin.einter@gmail.com</a>><br>To: <<a href="mailto:development@drupal.org" target="_blank">development@drupal.org</a>><br>
Cc: "Jason Flatt" <<a href="mailto:drupal@oadaeh.net" target="_blank">drupal@oadaeh.net</a>><br>Subject: [development] SQL Query Doubt<br>Date: Sat, Apr 16, 2011 7:33 am<br><br></div>
<div>
<div></div>
<div class="h5"><br>
<div>Hi</div>
<div>Thanks for reply.</div>
<div> </div>
<div>I have tried SELECT EmployeeID FROM {tablename} WHERE Skill = 'PHP' AND Skill = 'Java'; . It does not work.</div>
<div>Probably in SQL in same row of table both values are not matching.<br></div>
<div>Regards,<br>Austin<br></div>
<div class="gmail_quote">On Sat, Apr 16, 2011 at 4:54 PM, Jason Flatt <span dir="ltr"><<a href="mailto:drupal@oadaeh.net" target="_blank">drupal@oadaeh.net</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div></div>
<div>On Sat, 16 Apr 2011 16:09:59 +0530<br>Austin Einter <<a href="mailto:austin.einter@gmail.com" target="_blank">austin.einter@gmail.com</a>> wrote:<br><br>> Hi All<br>><br>> Lets say I have one table in below format.<br>
><br>> EmployeeID.............. Skill<br>> ------------------------------------------------------<br>> 1...............................PHP<br>> 1...............................SQL<br>> 1...............................Java<br>
> 1................................VoIP<br>><br>> 2................................Shell Scripting<br>> 2................................PHP<br>> 2................................Java<br>><br>> 3............................... C++<br>
> 3................................C<br>> 3.................................Pearl<br>><br>> I wan to do a SQL query for employess who MUST have skill PHP and Java.<br>> As per above table, the query result should show Employee 1 and 2.<br>
><br>> Now what should be the corresponding SQL query for it.<br><br></div></div>SELECT EmployeeID FROM {tablename} WHERE Skill = 'PHP' AND Skill = 'Java';<br><br>This might help a bit:<br><a href="http://dev.mysql.com/doc/refman/5.1/en/sql-syntax.html" target="_blank">http://dev.mysql.com/doc/refman/5.1/en/sql-syntax.html</a><br>
<font color="#888888"><br><br>--<br>Jason Flatt<br>Custom Website development solutions: <a href="http://www.oadaeh.net/" target="_blank">http://www.oadaeh.net/</a><br>Father of seven: <a href="http://www.flattfamily.com/" target="_blank">http://www.flattfamily.com/</a> (Joseph, 18; Cramer, 16; Travis,<br>
14; Angela; Harry, 10; William, 5; and Dolly, 2) Linux user:<br><a href="http://www.ubuntu.org/" target="_blank">http://www.ubuntu.org/</a> Android user: <a href="http://www.android.com/" target="_blank">http://www.android.com/</a><br>
Drupal fanatic: <a href="http://drupal.org/" target="_blank">http://drupal.org/</a><br></font></blockquote></div><br></div></div></blockquote></div><br>