$wpdb->подготовка по вложенному запросу Select ⇐ Php
$wpdb->подготовка по вложенному запросу Select
I'm strugling with a nested SELECT query that I want to prepare.
$sql = $wpdb->prepare("SELECT (SELECT Level FROM $bodyReaction WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS BodyReaction, (SELECT Level FROM $eyeToHand WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS EyeToHand, (SELECT Level FROM $highJump WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS HighJump, (SELECT Level FROM $legCoordination WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS LegCoordination, (SELECT Level FROM $longJump WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS LongJump, (SELECT Level FROM $sideToSide WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS SideToSideJump "); The query works fine without the prepare code.
Can anyone suggest how to fix the code.
Thanks Flemming
Источник: https://stackoverflow.com/questions/780 ... lect-query
I'm strugling with a nested SELECT query that I want to prepare.
$sql = $wpdb->prepare("SELECT (SELECT Level FROM $bodyReaction WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS BodyReaction, (SELECT Level FROM $eyeToHand WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS EyeToHand, (SELECT Level FROM $highJump WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS HighJump, (SELECT Level FROM $legCoordination WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS LegCoordination, (SELECT Level FROM $longJump WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS LongJump, (SELECT Level FROM $sideToSide WHERE UserID = %d ORDER BY Date DESC LIMIT 1, $currentUserId) AS SideToSideJump "); The query works fine without the prepare code.
Can anyone suggest how to fix the code.
Thanks Flemming
Источник: https://stackoverflow.com/questions/780 ... lect-query
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение