mysql query needed
not a programmer so need help with this one I am using Wordpress 3.0.2 and wp-calendar i hav looked at the mysql data base in PhpMyAdmin under wordpress - wp_calendar_categories - There is categories 0 -4 (5)
i wish to out put this data to a page in wordpress in the following format:-
for category 1 which is also in category 4 data output Title- date -time -location for category 2 which is also in category 4 data output Title- date -time -location for category 3 which is also in category 4 data output Title- date -time -location using the commands with the wp-calendar plugin will not gi开发者_开发百科ve me a output of cat1 in cat4 i can produce a list of all in each category in the following format Title - date - time- location
os any sql masters out there please help can give more info if required
THANKS
If I understand your question correctly you are trying to output information that is in multiple categories. For this you want a join.
SELECT title, date, time, location
FROM wp_calendar_categories c1
JOIN wp_calendar_categories c4
ON c1.title = c4.title
AND c1.date = c4.date
AND c1.time = c4.time
AND c1.location = c4.location
WHERE c1.category = 1
AND c4.category = 4
You can combine results (provided the columns are the same) using a union
SELECT title, date, time, location
....
UNION
SELECT title, date, time, location
I would advise searching on the web for SQL tutorials to help get you started.
精彩评论