[support] D7 Sql USING syntax
Ms. Nancy Wichmann
nan_wich at bellsouth.net
Fri Sep 21 10:27:01 UTC 2012
First, you don't have to convert a SELECT query.
$query->condition('us.uid' , $user->uid);
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
>________________________________
> From: Kamal Palei <palei.kamal at gmail.com>
>To: support at drupal.org
>Sent: Friday, September 21, 2012 1:14 AM
>Subject: [support] D7 Sql USING syntax
>
>
>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
>
>
>--
>[ Drupal support list | http://lists.drupal.org/ ]
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120921/a211676a/attachment.html
More information about the support
mailing list