New answers tagged

0

Tricky around the oldest driver but I'll have a go: SELECT name, birthday FROM driver WHERE name in (SELECT name FROM driver where driver.address = 'haifa') AND d.id in (SELECT d.id FROM event_list) AND birthday = (SELECT DISTINCT MAX(birthday) FROM driver WHERE name IN (SELECT name FROM driver WHERE driver.address = ...


0

Try this code: SELECT TOP 1 name, birthday FROM driver INNER JOIN event_list ON driver.d_id=event_list.d_id WHERE driver.address='haifa' ORDER BY birthday;


0

Do I need to learn how to create a Macro/ a Routine/ a Sub Routine? Yes. See the Stack Overflow question below for an example of how to do it using VBA code and QueryDef objects. Is it possible to pass parameters programmatically in a Microsoft Access update query? If you require further assistance please as a new question on Stack Overflow.


0

This is most easily accomplished in an Access query by using the ConcatRelated() function. For more information see the following question on Stack Overflow: Combine values from related rows into a single concatenated string value


0

Try the below query will solve your problem: SELECT ID, STUFF( (SELECT ', ' + CAST(Item AS VARCHAR(20)) [text] FROM TBL12 WHERE ID = t.ID FOR XML PATH(''), TYPE) .value('.','NVARCHAR(MAX)'),1,2,' ') Items FROM TBL12 t GROUP BY ID Since you add many tags in the post, I solved in MSSQL using STUFF. Working fiddle: ...


1

Since your starting position is fixed (after the 2nd _), you can use an Instr() function to find the position of the 3rd _, and just take the characters between. Instr() returns the postion of the first instance of a character in a string. If the character is not found, it'll return 0. Note, Access considers the first character position to be 1. Give this ...


0

Easy enough to have a folder on your desktop so you can drag and drop the attachments into an overwrite then have you dB linked to the file/s in that folder. File names should always be attached the same.


0

I think your best bet would be to use a many to many relationship. Generally this is done with a table for the records (like you have now), a table for the comma delimited field and a primary key field with rows for each of the entries (one for x, one for y and one for z) and a third table with nothing but that keys from the other 2 tables. So, in your join ...


3

There are some problems with your attempt WHERE is supposed to be before the GROUP BY (I assume this is true for ms-access) The EXISTS predicate will be TRUE if there is a director, regardless if this has anything to do with the actor under investigation. For the first part I would try something like: SELECT Actors.FirstName, Actors.LastName FROM ...


0

This answer based on @jean's answer, I fixed some small mistaks this code is working: SELECT DISTINCT Directors.FirstName, Directors.LastName FROM ((Directors INNER JOIN DirectorsMovies ON DirectorsMovies.DirectorID = Directors.DirectorID) INNER JOIN ActorsMovies ON ActorsMovies.MovieID = DirectorsMovies.MovieID) INNER JOIN Actors ON Actors.ActorID = ...


1

You could need brackets. Try this: SELECT Actors.FirstName,Actors.LastName FROM ((Actors INNER JOIN ActorsMovies ON Actors.ActorID= ActorsMovies.ActorID) INNER JOIN GenresMovies ON ActorsMovies.MovieID=GenresMovies.MovieID);


1

This code is working well: SELECT GenreDescr FROM (SELECT Genres.GenreDescr,COUNT(GenresMovies.GenreID) AS MCount FROM GenresMovies,Genres WHERE GenresMovies.GenreID =Genres.GenreID GROUP BY GenresMovies.GenreID,Genres.GenreDescr) WHERE MCount= ( SELECT MAX(MCount) FROM (SELECT COUNT(GenresMovies.GenreID) AS MCount FROM GenresMovies, ...


2

It's just a set of direct joins and on the filter clause you can check the names of actor to fit of the director. Note also this avoids cases where someone is an actor of another director movie but is also one director of another movie (where he/she is not an actor). I used explicit join because they are prefearable over implicit ones. select distinct ...


-1

THis will only give you count of movies after that you can apply having or where to get max etc and for movie or genre name use inner join with their parent tables Select Count(*),MovieID From GenresMovies Group By MovieID


4

I think this one needs a subquery, although someone else may prove me wrong. Lets take it step-by-step: First, lets get the genre of every movie in GenresMovies, along with the description: -- query 1 -- SELECT gm.GenreID, g.GenreDescr FROM GenresMovies gm, Genres g WHERE gm.GenreID = g.GenreID; Note this is an alternate syntax for performing an ...


1

Could this be related to caching with Kerberos? (just a guess though might be unrelated) http://blogs.technet.com/b/tspring/archive/2014/06/23/viewing-and-purging-cached-kerberos-tickets.aspx


7

As mentioned in the comments, Oracle doesn't like the square brackets around identifiers, and it also doesn't support TOP n clauses, however, you can work around that with a couple of simple changes: SELECT T1.*, (SELECT T3.SMN_DATEC-1 FROM (SELECT T2.DET_NUMBERA , T2.SMN_DATEC , row_number() over (ORDER BY ...



Top 50 recent answers are included