Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

like in mysql

0 views
Skip to first unread message

monkeys paw

unread,
Nov 7, 2009, 3:52:31 PM11/7/09
to
Assuming there are records in the bills tables where
the id field is "AK2009H45", why doesn't the following
statement work?

select * from bills where id like "AK*45";

Jerry Stuckle

unread,
Nov 7, 2009, 3:56:49 PM11/7/09
to

Because asterisk is not a wildcard in SQL.

Check the documentation for the LIKE clause.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

monkeys paw

unread,
Nov 7, 2009, 5:49:17 PM11/7/09
to
Jerry Stuckle wrote:
> monkeys paw wrote:
>> Assuming there are records in the bills tables where
>> the id field is "AK2009H45", why doesn't the following
>> statement work?
>>
>> select * from bills where id like "AK*45";
>
> Because asterisk is not a wildcard in SQL.
>
> Check the documentation for the LIKE clause.
>

Ah yes, thanks. So '%' is wildcard now.

Captain Paralytic

unread,
Nov 7, 2009, 6:23:16 PM11/7/09
to

"now"? It has been for as long as I have coded SQL!

Jerry Stuckle

unread,
Nov 7, 2009, 7:05:14 PM11/7/09
to

At least since the late 70's :)

monkeys paw

unread,
Nov 8, 2009, 2:14:31 AM11/8/09
to
Jerry Stuckle wrote:
> Captain Paralytic wrote:
>> On 7 Nov, 22:49, monkeys paw <u...@example.net> wrote:
>>> Jerry Stuckle wrote:
>>>> monkeys paw wrote:
>>>>> Assuming there are records in the bills tables where
>>>>> the id field is "AK2009H45", why doesn't the following
>>>>> statement work?
>>>>> select * from bills where id like "AK*45";
>>>> Because asterisk is not a wildcard in SQL.
>>>> Check the documentation for the LIKE clause.
>>> Ah yes, thanks. So '%' is wildcard now.
>>
>> "now"? It has been for as long as I have coded SQL!
>
> At least since the late 70's :)
>

yea, i've been using '*' since the late 80's, i've been
diverted by the multiplicity of languages and syntaxes
over the years

Robert Hairgrove

unread,
Nov 8, 2009, 5:19:37 AM11/8/09
to
monkeys paw wrote:
> yea, i've been using '*' since the late 80's, i've been
> diverted by the multiplicity of languages and syntaxes
> over the years

AFAIK, the '*' wildcard with LIKE is only valid in MS-Access "SQL"
(which gives an error with '%' ...duh...).

Captain Paralytic

unread,
Nov 8, 2009, 7:10:06 AM11/8/09
to
On 8 Nov, 00:05, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Captain Paralytic wrote:
> > On 7 Nov, 22:49, monkeys paw <u...@example.net> wrote:
> >> Jerry Stuckle wrote:
> >>> monkeys paw wrote:
> >>>> Assuming there are records in the bills tables where
> >>>> the id field is "AK2009H45", why doesn't the following
> >>>> statement work?
> >>>>  select * from bills where id like "AK*45";
> >>> Because asterisk is not a wildcard in SQL.
> >>> Check the documentation for the LIKE clause.
> >> Ah yes, thanks. So '%' is wildcard now.
>
> > "now"? It has been for as long as I have coded SQL!
>
> At least since the late 70's :)
>
Which is before I started coding SQL. I'm only (relatively) young!

Jerry Stuckle

unread,
Nov 8, 2009, 7:38:04 AM11/8/09
to

With what - MS SQL? Not in any ANSI standard SQL.

monkeys paw

unread,
Nov 9, 2009, 4:13:01 PM11/9/09
to
Jerry Stuckle wrote:
> monkeys paw wrote:
>> Jerry Stuckle wrote:
>>> Captain Paralytic wrote:
>>>> On 7 Nov, 22:49, monkeys paw <u...@example.net> wrote:
>>>>> Jerry Stuckle wrote:
>>>>>> monkeys paw wrote:
>>>>>>> Assuming there are records in the bills tables where
>>>>>>> the id field is "AK2009H45", why doesn't the following
>>>>>>> statement work?
>>>>>>> select * from bills where id like "AK*45";
>>>>>> Because asterisk is not a wildcard in SQL.
>>>>>> Check the documentation for the LIKE clause.
>>>>> Ah yes, thanks. So '%' is wildcard now.
>>>>
>>>> "now"? It has been for as long as I have coded SQL!
>>>
>>> At least since the late 70's :)
>>>
>>
>> yea, i've been using '*' since the late 80's, i've been
>> diverted by the multiplicity of languages and syntaxes
>> over the years
>
> With what - MS SQL? Not in any ANSI standard SQL.
>

'*' is Informix, i hadn't realized how far the drift was
from ANSI

Jerry Stuckle

unread,
Nov 9, 2009, 4:30:37 PM11/9/09
to

Ah, yes, good old Informix. I haven't used it in years; almost
completely forgot about it!

The Natural Philosopher

unread,
Nov 10, 2009, 6:46:56 AM11/10/09
to
I remember % in informix..odd that. Maybe my memory is faulty..
Message has been deleted
0 new messages