Problem with query
I am having a small problem with a small mysql query... I want to make a list of: WHO HAS NOT PAID THEIR MEMBERSHIP FEE. I guess I could maybe solve this one myself, its not too hard ... I have one table with members MEMBERS -- | MemberID | Name | etc. One table with fee payments FEE_PAYMENTS -- | MemberID | date | price | etc... Now: How would I make a query that would list all members that have not paid their fee? How would I make a query that would list all members that have paid their fee? I'm just too tired to think it out myself :) Forgive me :) - Med vennlig hilsen, Torkil Johnsen [EMAIL PROTECTED] - - 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 [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Howto: insert PHP code into mysql blobs
Just a noob question... (I suppose) When I try just putting php code in my insert query, it goes like this: insert into mytable values('?php echo some string; ?') select * from mytable, returns: ?php echo some string; ?Some string Any help would be greatly appreciated! - 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 [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
A small SQL query problem
A small SQL query problem concerning articles and article_comments :) You experts will have no problem with this :) In brief: - I have no problems displaying the title, date, author, summary of the articles or anything. Its just doing an sql query that gets my 3 latest articles AND counts how many comments each article has, and doing it in ONE query instead of two separate ones... :( In *not* brief: --- I have 2 tables. One contains articles, basically like this: --- | id | title | summary | text | date | author | --- The other containts comments to the articles, basically looks like this: --- | id | article_id | text | author | --- Now, on my main page I want to display the first 3 articles like this: TITLETITLETITLETITLETITLE (date) written by AUTHOR SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY Read the whole story (comments: ##) My actual problem is how to get the number of comments (##)! I have no problems displaying the title, date, author, summary or anything. Its just doing an sql query that counts how many comments the article has, and doing it in ONE query instead of two separate ones... :( - 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 [EMAIL PROTECTED] To unsubscribe, e-mail mysql-unsubscribe-##L=##[EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: A small SQL query problem
Thanks for the suggestion! I modified your query to something that works for me (I was inaccurate with the column names before, sorry... :) SELECT a.article_id,a.title,a.date,a.summary,COUNT(c.id) as comments FROM articles as a,article_comments as c WHERE a.article_id = c.article_id GROUP BY a.article_id,a.title,a.date,a.summary ORDER BY a.date DESC LIMIT 3 This works PERFECTLY Except: If an article has NO comments, it is not returned at all! So: When my articles table contains only 3 articles, and I make a query that has LIMIT 3, you would think that this query would return all articles, but it does not: Only the ones that actually has one or more comments. I tried this with 3 articles where 2 of them had comments: Only 2 rows returned. When I gave one comment on the last article: 3 rows returned. Seems like if COUNT(c.id) returns 0, then the row is not returned at all. Suggestions? * Torkil Johnsen [...] I have no problems displaying the title, date, author, summary of the articles or anything. Its just doing an sql query that gets my 3 latest articles AND counts how many comments each article has, and doing it in ONE query instead of two separate ones... :( [...] One contains articles, basically like this: --- | id | title | summary | text | date | author | --- The other containts comments to the articles, basically looks like this: --- | id | article_id | text | author | --- Now, on my main page I want to display the first 3 articles like this: TITLETITLETITLETITLETITLE (date) written by AUTHOR SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY SUMMARY Read the whole story (comments: ##) My actual problem is how to get the number of comments (##)! **ROGER Try something like this: SELECT a.title,a.date,a.author,a.summary,COUNT(c.id) as comments FROM articles as a,article_comments as c WHERE a.id = c.article_id GROUP BY a.title,a.date,a.author,a.summary ORDER BY a.date DESC LIMIT 3 -- Roger - 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 [EMAIL PROTECTED] To unsubscribe, e-mail mysql-unsubscribe-##L=##[EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Need some easy select assistance
Given this example: table CARS has got an entity Labourghini with car_id=5 table NEWS has got an entity Lambourghini displays new super model with date=2002-05-02, news_id=735 and car_id=5 Now: I want this output: NEWS HEADLINES date: headline (car_brand) Can I do this without 2 select queries? As of now, I would typically first select news, then get the car_id from news and the do a select in the cars table, based on what kind of car_id the news entity returned. This should be pretty straight forward... I hope :) - Torkil - 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 [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Problem with norwegian characters
A friend of mine is having a problem with the 3 norwegian characters æ Æ, ø Ø and å Å. (html: aelig; oslash; and aring;) When a string is inserted with either of these characters, and later selected and returned, they do not appear as they are supposed to. I.e: Ø becomes O. Also: Alphabetically sorting strings with these characters in them does not work. How do I set MySQL database language?? Or what do I need to do? - TOrkil - 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 [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Oracle - MySQL
Need some assistance... I have an already existing Oracle database, and wish to attach a MySQL database to it by using the primary keys in some Oracle tables as Foreign keys in some MySQL tables. I was just wondering how this would work out, as I have no prior knowledge to Oracle and thought maybe someone already have done something similar, or maybe could point me to an article or tutorial. Sincerely, Torkil Johnsen - 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 [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php