Search results

  1. S

    On Duplicate with two keys...

    Hi All, Is it possible? Below I am using with with one key, but I would like to check two fields now before updating/adding new record. What key it's looking for here? it has to be movie_id.. INSERT INTO tbl_movies_genre (tbl_movies_genre.movie_id, tbl_movies_genre.movie_genre) VALUES ('"&...
  2. S

    Inster or update in one query

    As I am using it from WEB access it has to be pure query. Is it not doable in one query?
  3. S

    Inster or update in one query

    Hi guys, I got help from here with the query below and it works like a dream... However now I would like something like that but for two unique keys... Is it possible... the table looks like this: ID movie_id user_id comment So I would like to enter new entry but if there is already...
  4. S

    Retrieve ID on INSERT query

    Yeh, yeh... it was just to say that if it has to be separate query then it can be anything. I thought maybe it can be done in one query...
  5. S

    Retrieve ID on INSERT query

    But if I have to do it in a separate query, then I can just ask for ID where fname = 'name'?
  6. S

    Retrieve ID on INSERT query

    HI, Can I create a query which will return ID for me from newly created record? Something like: SELECT tbl_users.user_id FROM tbl_users (INSERT INTO tbl_users tbl_users.user_fname, tbl_users.user_lname) VALUES ('bla', 'bls');
  7. S

    Ambiguous joins

    How can I change then something like that: It works but it has Right and Left in the syntax and I think I can move things around to achieve the same result but only using LEFT, not sure how to do it though.... SELECT tbl_movies.movie_title, tbl_movies_genre.movie_genre...
  8. S

    Find a letter(s) in a field...

    Hi All, I am trying to create some autocomplete function (really simple one) but not sure how SQL should look for that. How can I ask DB if letters "xyz" (in that exact form) exists in the field. Or if word "hi exist in a field? Thanks.
  9. S

    Ambiguous joins

    I think I do....
  10. S

    Ambiguous joins

    Uuu, your code looks much nicer and more readible.. I will do that as wel form now. Sorry and thanks again
  11. S

    Ambiguous joins

    Got it.... SELECT tbl_movies.movie_title, tbl_movies.movie_year, tbl_movies.movie_imdb, tbl_movies_genre.movie_genre, tbl_users_comments.comment FROM (tbl_movies LEFT JOIN tbl_users_comments ON tbl_movies.movie_id = tbl_users_comments.movie_id) LEFT JOIN tbl_movies_genre ON tbl_movies.movie_id...
  12. S

    Ambiguous joins

    Nice explanation, thank you I am trying now…. ;-)
  13. S

    Ambiguous joins

    Yeh, that's the thing. When I do that in the designer I get the error about ambiguous joins
  14. S

    Ambiguous joins

    thanks, what is the structure of that? how do I connect them...
  15. S

    Ambiguous joins

    Hi all, I am trying to create SQL query with multiple joins (2 to start with) and I know from access that I have to creata first one join in one query and then use that query with another join. But how do I do this in SQL (I have to send SQL request to my Access DB from a webpage, so I have to...
  16. S

    Select distinct

    I think the problem was the "first" clouse. After changing it to "count" or "max" it works straight away... It must be that that version of mySQL doesn't support that function.
  17. S

    Select distinct

    Of course I can ;-) you just have to add at the end: HAVING (((Count(tableB.fieldA))>0)) so in my case it's SELECT tbl_movies.movie_id, tbl_movies.movie_title, tbl_movies.movie_year, tbl_movies.movie_imdb, Count(tbl_users_comments.movie_id) AS ['users comments'] FROM tbl_movies LEFT JOIN...
  18. S

    Select distinct

    Not sure what was wrong. Check it again and MAX works!!!! Thanks again - and count works as well...
  19. S

    Select distinct

    Tried that already ;-(
  20. S

    Select distinct

    Maybe it's me ;-) SELECT tbl_movies.movie_id, tbl_movies.movie_title, tbl_movies.movie_year, tbl_movies.movie_imdb, MAX( tbl_users_comments.comment_id ) AS [ 'users comments'] FROM tbl_movies LEFT JOIN tbl_users_comments ON tbl_movies.movie_id = tbl_users_comments.movie_id GROUP BY...
Back
Top Bottom