Ciao uso mysql devo fare una select che mi estragga gli ultimi 6 record per quel campo con il valore più basso il campo è un campo int(3) ... un aiutino![]()
Ciao uso mysql devo fare una select che mi estragga gli ultimi 6 record per quel campo con il valore più basso il campo è un campo int(3) ... un aiutino![]()
ho fatto così ma non mi funzia ...![]()
mi da questo erroreCodice PHP:<%
Dim rsmin, sqlmin
Set rsmin = Server.CreateObject("ADODB.Recordset")
sqlmin="select MIN(pzminimo) from hotel where visualizza=1 and paginadedicata IS NULL order by id desc LIMIT 6"
rsmin.open sqlmin, adoCon, 3, 3
if not rsmin.eof then
do until Rsmin.eof%>
<%=rsmin("nome")%>
<%
rsmin.movenext
loop
else%>
Nessun hotel attualmente trovato!
<% end if
rsmin.close
set rsmin=Nothing%>
ADODB.Recordset error '800a0cc1'
Impossibile trovare l'oggetto nell'insieme corrispondente al nome o al numero richiesto.
... TOP 6 ... ORDER BY valore DESC
non funzia ..uso mysql cmq e il campo che mi deve controllare è un int(3)
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
Il driver ODBC non supporta le proprietà richieste.
posta l'istruzione che hai usato
Su mySQL la funzione TOP non esiste.Originariamente inviato da optime
... TOP 6 ... ORDER BY valore DESC
Si usa LIMIT in coda alla query.
@slay
te richiami il campo nome che NON hai specificato nella query.
io ho fatto così:
select MIN(pzminimo) from hotel where visualizza=1 and paginadedicata IS NULL order by id desc LIMIT 6
devo aggiungere un * da qualche parte..
codice:sqlmin = "select * from hotel where visualizza=1 and paginadedicata IS NULL order by pzminimo desc LIMIT 6"
grazie Mems alla fine era semplice ..
domanda: ma allora MIN() a che serve?
MIN è una funzione SQL ANSI 99 che, però, non so se è supportata da mySQL.Originariamente inviato da slay
grazie Mems alla fine era semplice ..
domanda: ma allora MIN() a che serve?