carolcastro
Posts: 24
|
Posted: 07/21/2004, 6:41 AM |
|
Hey Guys,
I´m trying to use a select distinct query... as i read in other topics, i did it in the sql mode. But when there is no parameters for the search, my grid return with no records.
I tried to figured out what was going on, and i found it that i need a default value for each where i am querying.
Is the a way to make the distinct without the default values???
Thanks!!!
_________________
Carol Castro |
|
|
peterr
Posts: 5971
|
Posted: 07/22/2004, 12:59 AM |
|
No, because SQL syntax like "WHERE abc=" is invalid. There must be some value to create valid syntax.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
Walter Kempees
|
Posted: 07/22/2004, 1:43 AM |
|
Where 1 = 1 ? is a valid where clause.
But I have two questions
1: what is the distinct select you are trying to do?
2: what does carolcastro mean with in SQL mode?
"peterr" <peterr@forum.codecharge> schreef in bericht
news:540ff73cbaf9f4@news.codecharge.com...
> No, because SQL syntax like "WHERE abc=" is invalid. There must be some
value to
> create valid syntax.
> _________________
> Peter R.
> YesSoftware Support Representative
> http://support.codecharge.com
> Warning: I use Google
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
carolcastro
Posts: 24
|
Posted: 07/22/2004, 6:39 AM |
|
Hey guys,
Whe I say SQL Mode I mean Data Source Type - SQL.
Here is my query:
SELECT DISTINCT(v2vusuario.idv2vusuario), username, nome, avatar, cidade, sigla
FROM v2v_publico RIGHT JOIN (v2vusuario INNER JOIN estados ON
v2vusuario.estado = estados.idestado) ON
v2v_publico.idv2vusuario = v2vusuario.idv2vusuario
WHERE cidade LIKE '%{s_cidade}%'
AND v2vusuario.estado = {s_estado}
AND ( username LIKE '%{s_keyword}%'
OR email LIKE '%{s_keyword}%'
OR nome LIKE '%{s_keyword}%'
OR descricao LIKE '%{s_keyword}%' )
Thanks!
_________________
Carol Castro |
|
|
peterr
Posts: 5971
|
Posted: 07/22/2004, 1:20 PM |
|
So now we can see that without default values your query would be invalid:
SELECT DISTINCT ... FROM ...
WHERE cidade LIKE ''
AND v2vusuario.estado =
AND ( username LIKE ''
OR email LIKE ''
OR nome LIKE '')
That's probably the reason the default values are needed.
But you can structure your WHERE statement in such way that it selects records when default value is so and so. For example see: http://forums.codecharge.com/posts.php?post_id=27344 http://forums.codecharge.com/posts.php?post_id=48740
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
|