List:General Discussion« Previous MessageNext Message »
From:Michael Date:November 3 2001 3:09am
Subject:Re: Need help with a query ...
View as plain text  
You need to use the LIKE command I think. The MySQL manual should give you
all the details. If you need further help I can just write the whole query
out for you. Or was the problem that you only want to worry about the
if..then stuff if needed? If so could you tell what your pulling back from
that table?

"The principal mark of genius is not perfection but originality, the
opening of new frontiers."
                                       -- Arthur Koestler

*^*^*^*
Michael McGlothlin <mogmios@stripped>
http://mlug.missouri.edu/~mogmios/projects/

On Fri, 2 Nov 2001, John Kelly wrote:

> Hi, I have a MySQL table with a column that contains some of a web site
> directory's category names in the format:
> 
> Sports:Football:Players
> 
> I am trying to build a query that that locates all records that match the
> above category name OR if none exist its parent "Sports:Football" OR if none
> exist its parent "Sports". The top level category, in this case "Sports",
> will always have at least one matching record.
> 
> I know I can do this with multiple queries by checking the previous query's
> result, but I am trying to build a query that does it all in one lookup to
> avoid lots of lookups in deep categories. Something along the logical lines
> of ...
> 
> SELECT * FROM table WHERE category = 'Sports:Football:Players' OR IF NONE
> category = 'Sports:Football' OR IF NONE category = 'Sports'
> 
> ... of course the above query does not work but if anyone knows of how to
> accomplish something similar in one query I would much appreciate it.
> 
> Thanks!
> 
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <mysql-thread89920@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-mogmios=mlug.missouri.edu@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 

Thread
Need help with a query ...John Kelly3 Nov
  • Re: Need help with a query ...Michael3 Nov
    • Re: Need help with a query ...John Kelly3 Nov
  • Re: Need help with a query ...Bob Hall3 Nov
  • Re: Need help with a query ...Anvar Hussain K.M.5 Nov