Search results

  1. S

    How to add one more table to the query

    Hi all, How can I connect that forth table? At the moment it just lists all comments for a particular movie. I would like to add score as well if exists. Is it possible?
  2. S

    Condition WHERE only for one field

    HI all, It is possible to do something like this: SELECT tbl1.fld1, (AVG(tbl2.fld1) WHERE tbl2.fld1>0) FROM ...... What I mean here is that I want to calculate avg only from fields >0 but I want to list all records but some will not have AVG at all. It's list of movies and in tbl2 I keep...
  3. S

    Filter AVG in long query

    Hi All, I have a query which works like I want but it calculates AVG in the wrong way. 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', AVG(tbl_users_comments.score) AS 'users average'...
  4. S

    Connecting three tables in one query...

    Hi All, Hwo I can connect these three tables in one query? tbl_movies keeps main data about the movies movie_id (U) movie_title movie_year movie_imdb movie_entryDate tbl_users_comments keeps users comments comment_id (U) movie_id user_id comment...
  5. S

    What's wrong...

    What's wrong...(Left, Right joins) HI all, I know I messed up here but I have no idea what's wrong. I think that query is above me. I was adding and adding stuff to it and now I don't know what going on here... SELECT tbl_movies.movie_title AS 'Movie Title', tbl_movies.movie_year AS Year...
  6. 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 ('"&...
  7. 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...
  8. 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');
  9. 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.
  10. 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...
  11. S

    Select distinct

    HI all, I have a simple query: SELECT tableA.fieldA, tableA.fieldB, tableB.fieldA FROM tableA LEFT JOIN tableB ON tableA.fieldID = tableB.fieldID; So now if there are two entries in tableB for any entry in tableA I will have two results for that field, but I just want to have one (the first...
  12. S

    Creating separate queries with join

    Hi All, I am trying do create simple online movie DB for myself and my friends to use, but first of course I have to design properly my DB. As I am not really good with SQL I have problems straight at the beginning ;-(. The error I am having is: "The SWL statement could not be executed...
Back
Top Bottom