Forum » Programiranje » SQL problem
SQL problem
Equinoxe ::
A mi lahko kdo pove kaj bi bilo v spodnjem SQL-u narobe, da ga Visual Basic ne potegne.
Sql = "SELECT tblLocation.IDLocation " & _
"FROM tblLocation_state INNER JOIN (tblLocation_city INNER JOIN " & _
"(tblLocation_address INNER JOIN tblLocation ON tblLocation_address.IDLocation_address " & _
"= tblLocation.IDLocation_address) ON tblLocation_city.IDLocation_city = tblLocation.IDLocation_city) " & _
"ON tblLocation_state.IDLocation_state = tblLocation.IDLocation_state " & _
"GROUP BY tblLocation.IDLokacija, tblLocation_state.Location_state, tblLocation_city.Location_city, tblLocation_address.Location_address " & _
"HAVING (((tblLocation_state.Location_state) Like '*" & State & "*') AND ((tblLocation_city.Location_city) Like '*" & city & "*') " & _
"AND ((tblLocation_address.Location_address) Like '*" & address & "*'));"
V Accessu namreč dela (čeprav Accessov SQL ni enako kot VB SQL).
Vrednosti state, address, city so pravilne (da mi kaj ne manjka).
Sql = "SELECT tblLocation.IDLocation " & _
"FROM tblLocation_state INNER JOIN (tblLocation_city INNER JOIN " & _
"(tblLocation_address INNER JOIN tblLocation ON tblLocation_address.IDLocation_address " & _
"= tblLocation.IDLocation_address) ON tblLocation_city.IDLocation_city = tblLocation.IDLocation_city) " & _
"ON tblLocation_state.IDLocation_state = tblLocation.IDLocation_state " & _
"GROUP BY tblLocation.IDLokacija, tblLocation_state.Location_state, tblLocation_city.Location_city, tblLocation_address.Location_address " & _
"HAVING (((tblLocation_state.Location_state) Like '*" & State & "*') AND ((tblLocation_city.Location_city) Like '*" & city & "*') " & _
"AND ((tblLocation_address.Location_address) Like '*" & address & "*'));"
V Accessu namreč dela (čeprav Accessov SQL ni enako kot VB SQL).
Vrednosti state, address, city so pravilne (da mi kaj ne manjka).
b ::
Malenkost offtopic, ampak cemu sluzi WHERE column LIKE '%' ? :-) Pustis lepo brez pogoja, pa je. Sicer bi spodoben SQL server zadevo optimiziral (beri: ne uposteval pogoja), ampak nikoli ne ves :-) Ce pa * ni enako %, potem bi bil namesto LIKE boljsi enacaj, ampak tu spet pride v postev optimizacija. Whatever. Enlighten me, please.
BigWhale ::
Banzai!
Hmm, pa saj nima nikjer LIKE '*'; Ali pa jest ne vidim... :)
Anyway, sql tega ne bi smel optimizirat in ven vrect ampak bi moral en moronic user error ven zabrisat ;>
--
BigW!
Hmm, pa saj nima nikjer LIKE '*'; Ali pa jest ne vidim... :)
Anyway, sql tega ne bi smel optimizirat in ven vrect ampak bi moral en moronic user error ven zabrisat ;>
--
BigW!
b ::
AND ((tblLocation_city.Location_city) Like '*' ...
Saj mogoce ma pa to kaksen pomen. As said, whatever :-) Na vprasanje pa ne vem odgovora, I don't do basic in any of its forms.
Saj mogoce ma pa to kaksen pomen. As said, whatever :-) Na vprasanje pa ne vem odgovora, I don't do basic in any of its forms.
Equinoxe ::
OK...
en po en!
Jaz sem do sedaj pri Like vedno uporabljal * (zvezdica). Pa vse dela.
Naj še poven, da imam v isti kodi, na isto bazo priklopljeno.... še en SQL, le da tam iščem le po state in address... PA DELA!
Ta ima pa en pogoj več pa NULA!?
Enačaja glih nebi uporaljal pri zadevi ker gre za stringe. In da, nikjer ni Like '*'.... Sigurno je Like 'Nebraska' ipd.
Vem ker msgboxi pred SQL mi to povejo.
Tukaj
AND ((tblLocation_city.Location_city) Like '*' ni '*' ampak vedno recimo 'Maribor' ali pa 'Cjele' ipd.
Še pišite
en po en!
Jaz sem do sedaj pri Like vedno uporabljal * (zvezdica). Pa vse dela.
Naj še poven, da imam v isti kodi, na isto bazo priklopljeno.... še en SQL, le da tam iščem le po state in address... PA DELA!
Ta ima pa en pogoj več pa NULA!?
Enačaja glih nebi uporaljal pri zadevi ker gre za stringe. In da, nikjer ni Like '*'.... Sigurno je Like 'Nebraska' ipd.
Vem ker msgboxi pred SQL mi to povejo.
Tukaj
AND ((tblLocation_city.Location_city) Like '*' ni '*' ampak vedno recimo 'Maribor' ali pa 'Cjele' ipd.
Še pišite
BigWhale ::
B:
AND ((tblLocation_city.Location_city) Like '*" & city & "*')
tole bi v phpju zapisal kot
"AND ((tblLocation_city.Location_city) Like '*" + $city + "*')"
Not se vstavi vrednost spremenljivke city...
Equinoxe:
Mogoce je pa nula, ker dejansko nicesar ne najde?
--
BigW
AND ((tblLocation_city.Location_city) Like '*" & city & "*')
tole bi v phpju zapisal kot
"AND ((tblLocation_city.Location_city) Like '*" + $city + "*')"
Not se vstavi vrednost spremenljivke city...
Equinoxe:
Mogoce je pa nula, ker dejansko nicesar ne najde?
--
BigW
b ::
Ah, I'm enlightened. Zato se mi je zdel tolk cuden SQL stavek. & je v normalnih jezikih bitwise AND, dammit.
Se opravicujem za smetenje. I'm over & out. :-)
Se opravicujem za smetenje. I'm over & out. :-)
Equinoxe ::
Že rešil.
Kako se nisem prej spomnil....
Msgbox SQL
Potem ti izpiše cel SQL s kriteriji vred.
In potem vidim kje je bil moj problem. V enem kriteriju, ki je pisali * Pariz* - namesto *Pariz*.
Fora je bila v presledku pred Pariz. Ker sem bebo slabo delil string.
Hvala vsem za namige.
Kako se nisem prej spomnil....
Msgbox SQL
Potem ti izpiše cel SQL s kriteriji vred.
In potem vidim kje je bil moj problem. V enem kriteriju, ki je pisali * Pariz* - namesto *Pariz*.
Fora je bila v presledku pred Pariz. Ker sem bebo slabo delil string.
Hvala vsem za namige.
BigWhale ::
Banzai!
Za vecino problemov se tako ali tako izkaze, da je problem dejansko med stolom in tipkovnico...
--
BigW!
Za vecino problemov se tako ali tako izkaze, da je problem dejansko med stolom in tipkovnico...
--
BigW!
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | ip addressOddelek: Omrežja in internet | 1123 (1015) | amigo_no1 |
» | [Access] iskanje z formom / querijemOddelek: Programiranje | 1344 (1268) | zagy |
» | SQL vprašanjeOddelek: Izdelava spletišč | 2677 (2240) | jerneju |
» | SQL select problemčekOddelek: Programiranje | 1089 (959) | darh |
» | PHP in mySQLOddelek: Programiranje | 1941 (1649) | rasta |