RE: Newbie query question...

2004-02-04 Thread Mike Johnson
From: John Croson [mailto:[EMAIL PROTECTED] I have a simple query: SELECT id,year,month,day,cat_id FROM events LEFT JOIN calendar_cat ON events.cat=calendar_cat.cat_id WHERE year=YEAR(CURDATE()) AND month=MONTH(CURDATE()) AND day=DAYOFMONTH(CURDATE()) AND cat_id='2' OR cat_id='5' AND

Re: Newbie query question...

2004-02-04 Thread Johan Hook
Hi John, I think you missed on the precedence of AND/OR if you change to AND (cat_id='2' OR cat_id='5' ) it should work as you want it to /Johan John Croson wrote: I have a simple query: SELECT id,year,month,day,cat_id FROM events LEFT JOIN calendar_cat ON events.cat=calendar_cat.cat_id WHERE

Re: Newbie query question...

2004-02-04 Thread Michael Stassen
Mike Johnson wrote: From: John Croson [mailto:[EMAIL PROTECTED] I have a simple query: SELECT id,year,month,day,cat_id FROM events LEFT JOIN calendar_cat ON events.cat=calendar_cat.cat_id WHERE year=YEAR(CURDATE()) AND month=MONTH(CURDATE()) AND day=DAYOFMONTH(CURDATE()) AND cat_id='2' OR

Re: Newbie query question...

2004-02-04 Thread mos
At 09:35 AM 2/4/2004, John Croson wrote: I have a simple query: SELECT id,year,month,day,cat_id FROM events LEFT JOIN calendar_cat ON events.cat=calendar_cat.cat_id WHERE year=YEAR(CURDATE()) AND month=MONTH(CURDATE()) AND day=DAYOFMONTH(CURDATE()) AND cat_id='2' OR cat_id='5' AND approved='1'

Re: Newbie query question...

2004-02-04 Thread Michael Satterwhite
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wednesday 04 February 2004 16:03, mos wrote: At 09:35 AM 2/4/2004, John Croson wrote: I have a simple query: SELECT id,year,month,day,cat_id FROM events LEFT JOIN calendar_cat ON events.cat=calendar_cat.cat_id WHERE year=YEAR(CURDATE())

RE: Newbie Query Question

2003-03-16 Thread Uttam
is a crosstab is what you want? pls. give the result (output of the query) that you expect from the example and what you are actually getting. regds, -Original Message- From: Charles Kline [mailto:[EMAIL PROTECTED] Sent: Saturday, March 15, 2003 20:53 To: [EMAIL PROTECTED] Subject:

Re: Newbie Query Question

2003-03-15 Thread Jeff Kilpatrick
Charles- So, you have a table unique with respect to people (a person appears at most once), and a table with interests (some number of interests are associated a person in the first table. This is a one-to-many relationship. You need to join on the person in the first table. Something like

Re: Newbie Query Question

2003-03-15 Thread Charles Kline
Jeff, Thanks. This is ALMOST doing what I need. Suppose that the person could have from 0 - 5 records in tbl_peoples_interests and I need to have each one of those interests as a different name so I can use it in my PHP form? Thanks, Charles On Saturday, March 15, 2003, at 11:30 AM, Jeff

Re: Newbie Query Question

2003-03-15 Thread Jeff Kilpatrick
Charles- OK, let's say a person has `n' interest id entries in tbl_people_interests. It seems like you're wanting a result set with one row per person and (n + 2) (assuming you're selecting first and last name with the interests). I'm no UEbergeek with respect to SQL, but I don't think there's

Re: newbie query question

2002-09-12 Thread Jesse Sheidlower
On Thu, Sep 12, 2002 at 11:46:40AM -0700, Kip Krueger wrote: I need to query a mysql db in the following fashion ... find me all records whose column 'n' have the letters 'XY' as the first two characters. where column 'n' is just a short string to clarify ... if column 'n' has the