Alphabetical pagination mysql regexp query problem
Alphabetical pagination mysql regexp query problem
am 22.10.2010 05:07:10 von bharani kumar
--001636456f72406fb104932bf010
Content-Type: text/plain; charset=ISO-8859-1
Hi ,
Am just trying alphabetical pagination ,
Yes there is lot of pager class there for this ,
but in my requirement little but diff , that is
totally 4 sets ,
A-D E-H I-P Q-S (Assume there are pager links)
When user click the A-D , then it should show all the customer name starting
with A , B, C, D names should be pull out ,
For that i just used this REGEXP QUERY ,
[php]
SELECT * FROM tbl where Fname REGEXP '^[a]'
[/php]
This works fine, only rendering the starting with "a" Names ,
But if i add the or condition in that
[php]
SELECT * FROM tbl where Fname REGEXP '^[a|b|c|d]'
[/php]
This condition not working, the output for the above query , pullout the all
records starting wiht what ever,(A-z)
So What i want is,
if i hit A-D the it should pullout only matched character
example
Amir
Amboss
Aron
Basker
Banu
chithra
chan
dilli
but my out put should not like , because this not exact records for that
pager linke
Amir
Amboss
Aron
Basker
Banu
hanuman
chithra
gayathree
chan
dilli
vasanth
yakee
Even i tried somthing like these query ,
cFname REGEXP '^[[:<:]]a.*|b.*[[:>:]]'
cFname REGEXP '^[[:<:]]a.*|b.*'
If i add the OR condition in the REGEXP , then displaying unwanted records,
Also main thing , i want solution for case insensitive ,
Thanks
--
Regards
B.S.Bharanikumar
http://php-mysql-jquery.blogspot.com/
--001636456f72406fb104932bf010--
Re: Alphabetical pagination mysql regexp query problem
am 22.10.2010 05:25:39 von Michael Dykman
You regular expression is alittle off. You don't need the OR operator
'|' inside the character class definition, it is implied. Try this:
[php]
SELECT * FROM tbl where Fname REGEXP '^[abcd]'
[/php]
- michael dykman
On Thu, Oct 21, 2010 at 11:07 PM, bharani kumar
wrote:
> Hi ,
>
> Am just trying alphabetical pagination ,
>
> Yes there is lot of pager class there for this ,
>
> but in my requirement little but diff , that is
>
> totally 4 sets ,
>
> A-D =A0 =A0E-H =A0 =A0 I-P =A0 =A0Q-S (Assume there are pager links)
>
> When user click the A-D , then it should show all the customer name start=
ing
> with A , B, C, D names should be pull out ,
>
> For that i just used this REGEXP QUERY ,
>
> [php]
> SELECT * FROM tbl where Fname REGEXP '^[a]'
>
> [/php]
>
> This works fine, only rendering the starting with "a" Names ,
>
> But if i add the or condition in that
>
> [php]
> SELECT * FROM tbl where Fname REGEXP '^[a|b|c|d]'
> [/php]
>
> This condition not working, the output for the above query , pullout the =
all
> records starting wiht what ever,(A-z)
>
> So What i want is,
>
> if i hit A-D the it should pullout only matched character
>
> example
>
> Amir
> Amboss
> Aron
> Basker
> Banu
> chithra
> chan
> dilli
>
>
> but my out put should not like , because this not exact records for that
> pager linke
>
> Amir
> Amboss
> Aron
> Basker
> Banu
> hanuman
> chithra
> gayathree
> chan
> dilli
> vasanth
> yakee
>
>
> Even i tried somthing like these query ,
>
> cFname =A0REGEXP '^[[:<:]]a.*|b.*[[:>:]]'
> cFname =A0REGEXP '^[[:<:]]a.*|b.*'
>
>
> If i add the OR condition in the REGEXP , then displaying unwanted record=
s,
>
>
> Also main thing , i want solution for case insensitive ,
>
> Thanks
>
> --
> Regards
> B.S.Bharanikumar
> http://php-mysql-jquery.blogspot.com/
>
--=20
=A0- michael dykman
=A0- mdykman@gmail.com
=A0May the Source be with you.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
Re: Alphabetical pagination mysql regexp query problem
am 22.10.2010 17:01:36 von bharani kumar
--0016e65aeed640bb40049335eb12
Content-Type: text/plain; charset=ISO-8859-1
in my database,
if i want to render firstname and lastname match case ,
am using REGEXP '^[abcd]' WORK FOR SINGLE FIELD,
Now i have fname and lastname ,
How to make the query , which display both and single field satisfieds
records ,
That is my query should return like
Name(combined Firstname and lastname)
Abbas, Ajai,
Ashok,Amar,
Abdul,Baskar,
Abdul,cagan,
Arun,Deena
Any ideas
On Fri, Oct 22, 2010 at 8:55 AM, Michael Dykman wrote:
> You regular expression is alittle off. You don't need the OR operator
> '|' inside the character class definition, it is implied. Try this:
>
> [php]
> SELECT * FROM tbl where Fname REGEXP '^[abcd]'
> [/php]
>
> - michael dykman
>
> On Thu, Oct 21, 2010 at 11:07 PM, bharani kumar
> wrote:
> > Hi ,
> >
> > Am just trying alphabetical pagination ,
> >
> > Yes there is lot of pager class there for this ,
> >
> > but in my requirement little but diff , that is
> >
> > totally 4 sets ,
> >
> > A-D E-H I-P Q-S (Assume there are pager links)
> >
> > When user click the A-D , then it should show all the customer name
> starting
> > with A , B, C, D names should be pull out ,
> >
> > For that i just used this REGEXP QUERY ,
> >
> > [php]
> > SELECT * FROM tbl where Fname REGEXP '^[a]'
> >
> > [/php]
> >
> > This works fine, only rendering the starting with "a" Names ,
> >
> > But if i add the or condition in that
> >
> > [php]
> > SELECT * FROM tbl where Fname REGEXP '^[a|b|c|d]'
> > [/php]
> >
> > This condition not working, the output for the above query , pullout the
> all
> > records starting wiht what ever,(A-z)
> >
> > So What i want is,
> >
> > if i hit A-D the it should pullout only matched character
> >
> > example
> >
> > Amir
> > Amboss
> > Aron
> > Basker
> > Banu
> > chithra
> > chan
> > dilli
> >
> >
> > but my out put should not like , because this not exact records for that
> > pager linke
> >
> > Amir
> > Amboss
> > Aron
> > Basker
> > Banu
> > hanuman
> > chithra
> > gayathree
> > chan
> > dilli
> > vasanth
> > yakee
> >
> >
> > Even i tried somthing like these query ,
> >
> > cFname REGEXP '^[[:<:]]a.*|b.*[[:>:]]'
> > cFname REGEXP '^[[:<:]]a.*|b.*'
> >
> >
> > If i add the OR condition in the REGEXP , then displaying unwanted
> records,
> >
> >
> > Also main thing , i want solution for case insensitive ,
> >
> > Thanks
> >
> > --
> > Regards
> > B.S.Bharanikumar
> > http://php-mysql-jquery.blogspot.com/
> >
>
>
>
> --
> - michael dykman
> - mdykman@gmail.com
>
> May the Source be with you.
>
--
Regards
B.S.Bharanikumar
http://php-mysql-jquery.blogspot.com/
--0016e65aeed640bb40049335eb12--
Re: Alphabetical pagination mysql regexp query problem
am 22.10.2010 17:31:09 von Michael Dykman
Is this what you meant?
SELECT * FROM tbl where Fname REGEXP '^[abcd]' AND Lname REGEXP '^[abcd]'
(alternatively, the extression could be simpliefied as "REGEXP '^[a-d]" )
- md
On Fri, Oct 22, 2010 at 11:01 AM, bharani kumar
wrote:
> in my database,
>
>
> if i want to render firstname and lastname match case ,
>
> am using REGEXP '^[abcd]' WORK FOR SINGLE FIELD,
>
> Now i have fname and lastname ,
>
> How to make the query , which display both and single field satisfieds
> records ,
>
> That is my query should return like
>
> Name(combined Firstname and lastname)
>
> Abbas, Ajai,
> Ashok,Amar,
> Abdul,Baskar,
> Abdul,cagan,
> Arun,Deena
>
> Any ideas
>
>
> On Fri, Oct 22, 2010 at 8:55 AM, Michael Dykman wrote=
:
>>
>> You regular expression is alittle off. =A0You don't need the OR operator
>> '|' inside the character class definition, it is implied. =A0Try this:
>>
>> [php]
>> SELECT * FROM tbl where Fname REGEXP '^[abcd]'
>> [/php]
>>
>> =A0- michael dykman
>>
>> On Thu, Oct 21, 2010 at 11:07 PM, bharani kumar
>> wrote:
>> > Hi ,
>> >
>> > Am just trying alphabetical pagination ,
>> >
>> > Yes there is lot of pager class there for this ,
>> >
>> > but in my requirement little but diff , that is
>> >
>> > totally 4 sets ,
>> >
>> > A-D =A0 =A0E-H =A0 =A0 I-P =A0 =A0Q-S (Assume there are pager links)
>> >
>> > When user click the A-D , then it should show all the customer name
>> > starting
>> > with A , B, C, D names should be pull out ,
>> >
>> > For that i just used this REGEXP QUERY ,
>> >
>> > [php]
>> > SELECT * FROM tbl where Fname REGEXP '^[a]'
>> >
>> > [/php]
>> >
>> > This works fine, only rendering the starting with "a" Names ,
>> >
>> > But if i add the or condition in that
>> >
>> > [php]
>> > SELECT * FROM tbl where Fname REGEXP '^[a|b|c|d]'
>> > [/php]
>> >
>> > This condition not working, the output for the above query , pullout t=
he
>> > all
>> > records starting wiht what ever,(A-z)
>> >
>> > So What i want is,
>> >
>> > if i hit A-D the it should pullout only matched character
>> >
>> > example
>> >
>> > Amir
>> > Amboss
>> > Aron
>> > Basker
>> > Banu
>> > chithra
>> > chan
>> > dilli
>> >
>> >
>> > but my out put should not like , because this not exact records for th=
at
>> > pager linke
>> >
>> > Amir
>> > Amboss
>> > Aron
>> > Basker
>> > Banu
>> > hanuman
>> > chithra
>> > gayathree
>> > chan
>> > dilli
>> > vasanth
>> > yakee
>> >
>> >
>> > Even i tried somthing like these query ,
>> >
>> > cFname =A0REGEXP '^[[:<:]]a.*|b.*[[:>:]]'
>> > cFname =A0REGEXP '^[[:<:]]a.*|b.*'
>> >
>> >
>> > If i add the OR condition in the REGEXP , then displaying unwanted
>> > records,
>> >
>> >
>> > Also main thing , i want solution for case insensitive ,
>> >
>> > Thanks
>> >
>> > --
>> > Regards
>> > B.S.Bharanikumar
>> > http://php-mysql-jquery.blogspot.com/
>> >
>>
>>
>>
>> --
>> =A0- michael dykman
>> =A0- mdykman@gmail.com
>>
>> =A0May the Source be with you.
>
>
>
> --
> Regards
> B.S.Bharanikumar
> http://php-mysql-jquery.blogspot.com/
>
--=20
=A0- michael dykman
=A0- mdykman@gmail.com
=A0May the Source be with you.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg