Вопрос по MySQL

Discussion in 'PHP' started by Kaimi, 20 Dec 2007.

  1. Kaimi

    Kaimi Well-Known Member

    Joined:
    23 Aug 2007
    Messages:
    1,732
    Likes Received:
    811
    Reputations:
    231
    Есть скрипт с таким запросом:
    Code:
    $query="select id,srt,if(srt<=(select srt from Cat$Cat1 where id=$ID),1,0) as factor,
    	if(pid=$ID,1,0) as factor2,if(substring(title,1,1)=9,1,0) as factor3,";
    	if($start)	$query.="if((select (length(srt)+1) as len from Cat$Cat1 where id=$start)>=length(srt),0,1) as factor4,";
    	$query.="title
    	from Cat$Cat1 where "; if($ID) $query.=" id=$ID "; else $query.=" pid=0 ";  $query.=" $where 
    	order by binary srt";
    
    На одном серве такая конструкция работает, на другом нет (пишет Ошибка синтаксиса), подскажите в чем проблема?
     
    _________________________
    4 people like this.
  2. Mobile

    Mobile Elder - Старейшина

    Joined:
    18 Feb 2006
    Messages:
    1,089
    Likes Received:
    822
    Reputations:
    324
    Из за версии Бд скорей всего
     
    1 person likes this.
  3. Scipio

    Scipio Well-Known Member

    Joined:
    2 Nov 2006
    Messages:
    733
    Likes Received:
    544
    Reputations:
    190
    угу, подзапросы используются с версии 4.1 на 4.0 этот запрос не пройдет
     
    1 person likes this.
Loading...
Similar Threads - Вопрос MySQL
  1. GAiN
    Replies:
    3
    Views:
    7,522