[support] D7 Sql USING syntax

Kamal Palei palei.kamal at gmail.com
Fri Sep 21 05:14:13 UTC 2012


Hi All
I am trying to write a sql query in D7.


SELECT id, exp, name FROM {resubmt_users_skills} LEFT JOIN
{resubmt_skill_ids} USING (id) WHERE resubmt_users_skills.uid = $user.uid

The above query I want to write in D7.

        $query = db_select('resubmt_users_skills' , 'us');
        $query->leftJoin('resubmt_skill_ids' , 'si');
        $query->condition('USING(id)');
        $query->condition('us.uid = :uid' , array(':uid' => $user->uid));
        $result = $query->execute()->fetchAssoc();

 Looks above syntaxt is not correct. Can somebody pls tell me whats the
fault here and solution for that.



Thanks

Kamal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120921/f7548b00/attachment.html 


More information about the support mailing list