Query showing when a rental is overdue? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to output MySQL query results in CSV format?Inserting multiple rows in a single SQL query?MySQL Query GROUP BY day / month / yearHow to show the last queries executed on MySQL?Join vs. sub-queryMySQL JOIN the most recent row only?Query works as SELECT but not as Update?Sql grouping querySelect from subqueryHow to successfully use JOIN queries?
Can the Great Weapon Master feat's damage bonus and accuracy penalty apply to attacks from the Spiritual Weapon spell?
Can anything be seen from the center of the Boötes void? How dark would it be?
What is the appropriate index architecture when forced to implement IsDeleted (soft deletes)?
Denied boarding although I have proper visa and documentation. To whom should I make a complaint?
How to react to hostile behavior from a senior developer?
A term for a woman complaining about things/begging in a cute/childish way
Is it possible for SQL statements to execute concurrently within a single session in SQL Server?
Time to Settle Down!
When a candle burns, why does the top of wick glow if bottom of flame is hottest?
How to tell that you are a giant?
AppleTVs create a chatty alternate WiFi network
Maximum summed subsequences with non-adjacent items
Illegal assignment from sObject to Id
Why do we bend a book to keep it straight?
SF book about people trapped in a series of worlds they imagine
Project Euler #1 in C++
Why weren't discrete x86 CPUs ever used in game hardware?
As a beginner, should I get a Squier Strat with a SSS config or a HSS?
How does Python know the values already stored in its memory?
How does the math work when buying airline miles?
Most bit efficient text communication method?
How do I use the new nonlinear finite element in Mathematica 12 for this equation?
How do living politicians protect their readily obtainable signatures from misuse?
Selecting user stories during sprint planning
Query showing when a rental is overdue?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to output MySQL query results in CSV format?Inserting multiple rows in a single SQL query?MySQL Query GROUP BY day / month / yearHow to show the last queries executed on MySQL?Join vs. sub-queryMySQL JOIN the most recent row only?Query works as SELECT but not as Update?Sql grouping querySelect from subqueryHow to successfully use JOIN queries?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm getting error code: 1064 and can't seem to figure how to qrite this query correctly.
SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer,
customer.phone_number, video.title
FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer
INNER JOIN video ON rental.idVideo = video.idVideo
WHERE rental.return_date IS NULL
AND rent_date + INTERVAL DAY < CURRENT_DATE()
LIMIT 7;
I'm trying to create an event that will show who has a video currently rented that is overdue. It looks right to me thought I must be missing something!
mysql sql
add a comment |
I'm getting error code: 1064 and can't seem to figure how to qrite this query correctly.
SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer,
customer.phone_number, video.title
FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer
INNER JOIN video ON rental.idVideo = video.idVideo
WHERE rental.return_date IS NULL
AND rent_date + INTERVAL DAY < CURRENT_DATE()
LIMIT 7;
I'm trying to create an event that will show who has a video currently rented that is overdue. It looks right to me thought I must be missing something!
mysql sql
1
LIMIT
withoutORDER BY
makes little sense.
– The Impaler
Mar 8 at 20:35
oh my! let me try it with an ORDER BY rent_date.
– Devin Cavallero
Mar 8 at 20:37
Error 1064 usually points to the place in the code with the error.
– Gordon Linoff
Mar 8 at 20:39
I added the ORDER BY rent_date; still getting error 1064 it seems to be pinpointing line 7 which is "limit 7"
– Devin Cavallero
Mar 8 at 20:41
add a comment |
I'm getting error code: 1064 and can't seem to figure how to qrite this query correctly.
SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer,
customer.phone_number, video.title
FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer
INNER JOIN video ON rental.idVideo = video.idVideo
WHERE rental.return_date IS NULL
AND rent_date + INTERVAL DAY < CURRENT_DATE()
LIMIT 7;
I'm trying to create an event that will show who has a video currently rented that is overdue. It looks right to me thought I must be missing something!
mysql sql
I'm getting error code: 1064 and can't seem to figure how to qrite this query correctly.
SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer,
customer.phone_number, video.title
FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer
INNER JOIN video ON rental.idVideo = video.idVideo
WHERE rental.return_date IS NULL
AND rent_date + INTERVAL DAY < CURRENT_DATE()
LIMIT 7;
I'm trying to create an event that will show who has a video currently rented that is overdue. It looks right to me thought I must be missing something!
mysql sql
mysql sql
edited Mar 8 at 20:38
Gordon Linoff
799k37321426
799k37321426
asked Mar 8 at 20:33
Devin CavalleroDevin Cavallero
62
62
1
LIMIT
withoutORDER BY
makes little sense.
– The Impaler
Mar 8 at 20:35
oh my! let me try it with an ORDER BY rent_date.
– Devin Cavallero
Mar 8 at 20:37
Error 1064 usually points to the place in the code with the error.
– Gordon Linoff
Mar 8 at 20:39
I added the ORDER BY rent_date; still getting error 1064 it seems to be pinpointing line 7 which is "limit 7"
– Devin Cavallero
Mar 8 at 20:41
add a comment |
1
LIMIT
withoutORDER BY
makes little sense.
– The Impaler
Mar 8 at 20:35
oh my! let me try it with an ORDER BY rent_date.
– Devin Cavallero
Mar 8 at 20:37
Error 1064 usually points to the place in the code with the error.
– Gordon Linoff
Mar 8 at 20:39
I added the ORDER BY rent_date; still getting error 1064 it seems to be pinpointing line 7 which is "limit 7"
– Devin Cavallero
Mar 8 at 20:41
1
1
LIMIT
without ORDER BY
makes little sense.– The Impaler
Mar 8 at 20:35
LIMIT
without ORDER BY
makes little sense.– The Impaler
Mar 8 at 20:35
oh my! let me try it with an ORDER BY rent_date.
– Devin Cavallero
Mar 8 at 20:37
oh my! let me try it with an ORDER BY rent_date.
– Devin Cavallero
Mar 8 at 20:37
Error 1064 usually points to the place in the code with the error.
– Gordon Linoff
Mar 8 at 20:39
Error 1064 usually points to the place in the code with the error.
– Gordon Linoff
Mar 8 at 20:39
I added the ORDER BY rent_date; still getting error 1064 it seems to be pinpointing line 7 which is "limit 7"
– Devin Cavallero
Mar 8 at 20:41
I added the ORDER BY rent_date; still getting error 1064 it seems to be pinpointing line 7 which is "limit 7"
– Devin Cavallero
Mar 8 at 20:41
add a comment |
1 Answer
1
active
oldest
votes
Your where
clause is:
WHERE rental.return_date IS NULL AND
rent_date + INTERVAL DAY < CURRENT_DATE()
--------------------------^ ???
You need some number of days. I don't know what the correct value is.
you sir are brilliant! I was stuck on this for a good hour! thank you it worked! I got rid of limit 7 thinking that would add 7 days from the date it was rented the code now looks like this; SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer, customer.phone_number, video.title FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer INNER JOIN video ON rental.idVideo = video.idVideo WHERE rental.return_date IS NULL AND rent_date + INTERVAL 7 DAY < CURRENT_DATE() ORDER BY rent_date; thank you
– Devin Cavallero
Mar 8 at 20:44
Why didn't I spot it? Sigh.
– The Impaler
Mar 8 at 20:45
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55070617%2fquery-showing-when-a-rental-is-overdue%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your where
clause is:
WHERE rental.return_date IS NULL AND
rent_date + INTERVAL DAY < CURRENT_DATE()
--------------------------^ ???
You need some number of days. I don't know what the correct value is.
you sir are brilliant! I was stuck on this for a good hour! thank you it worked! I got rid of limit 7 thinking that would add 7 days from the date it was rented the code now looks like this; SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer, customer.phone_number, video.title FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer INNER JOIN video ON rental.idVideo = video.idVideo WHERE rental.return_date IS NULL AND rent_date + INTERVAL 7 DAY < CURRENT_DATE() ORDER BY rent_date; thank you
– Devin Cavallero
Mar 8 at 20:44
Why didn't I spot it? Sigh.
– The Impaler
Mar 8 at 20:45
add a comment |
Your where
clause is:
WHERE rental.return_date IS NULL AND
rent_date + INTERVAL DAY < CURRENT_DATE()
--------------------------^ ???
You need some number of days. I don't know what the correct value is.
you sir are brilliant! I was stuck on this for a good hour! thank you it worked! I got rid of limit 7 thinking that would add 7 days from the date it was rented the code now looks like this; SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer, customer.phone_number, video.title FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer INNER JOIN video ON rental.idVideo = video.idVideo WHERE rental.return_date IS NULL AND rent_date + INTERVAL 7 DAY < CURRENT_DATE() ORDER BY rent_date; thank you
– Devin Cavallero
Mar 8 at 20:44
Why didn't I spot it? Sigh.
– The Impaler
Mar 8 at 20:45
add a comment |
Your where
clause is:
WHERE rental.return_date IS NULL AND
rent_date + INTERVAL DAY < CURRENT_DATE()
--------------------------^ ???
You need some number of days. I don't know what the correct value is.
Your where
clause is:
WHERE rental.return_date IS NULL AND
rent_date + INTERVAL DAY < CURRENT_DATE()
--------------------------^ ???
You need some number of days. I don't know what the correct value is.
answered Mar 8 at 20:40
Gordon LinoffGordon Linoff
799k37321426
799k37321426
you sir are brilliant! I was stuck on this for a good hour! thank you it worked! I got rid of limit 7 thinking that would add 7 days from the date it was rented the code now looks like this; SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer, customer.phone_number, video.title FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer INNER JOIN video ON rental.idVideo = video.idVideo WHERE rental.return_date IS NULL AND rent_date + INTERVAL 7 DAY < CURRENT_DATE() ORDER BY rent_date; thank you
– Devin Cavallero
Mar 8 at 20:44
Why didn't I spot it? Sigh.
– The Impaler
Mar 8 at 20:45
add a comment |
you sir are brilliant! I was stuck on this for a good hour! thank you it worked! I got rid of limit 7 thinking that would add 7 days from the date it was rented the code now looks like this; SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer, customer.phone_number, video.title FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer INNER JOIN video ON rental.idVideo = video.idVideo WHERE rental.return_date IS NULL AND rent_date + INTERVAL 7 DAY < CURRENT_DATE() ORDER BY rent_date; thank you
– Devin Cavallero
Mar 8 at 20:44
Why didn't I spot it? Sigh.
– The Impaler
Mar 8 at 20:45
you sir are brilliant! I was stuck on this for a good hour! thank you it worked! I got rid of limit 7 thinking that would add 7 days from the date it was rented the code now looks like this; SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer, customer.phone_number, video.title FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer INNER JOIN video ON rental.idVideo = video.idVideo WHERE rental.return_date IS NULL AND rent_date + INTERVAL 7 DAY < CURRENT_DATE() ORDER BY rent_date; thank you
– Devin Cavallero
Mar 8 at 20:44
you sir are brilliant! I was stuck on this for a good hour! thank you it worked! I got rid of limit 7 thinking that would add 7 days from the date it was rented the code now looks like this; SELECT CONCAT(customer.last_name, ' , ', customer.first_name) AS customer, customer.phone_number, video.title FROM rental INNER JOIN customer ON rental.idCustomer = customer.idCustomer INNER JOIN video ON rental.idVideo = video.idVideo WHERE rental.return_date IS NULL AND rent_date + INTERVAL 7 DAY < CURRENT_DATE() ORDER BY rent_date; thank you
– Devin Cavallero
Mar 8 at 20:44
Why didn't I spot it? Sigh.
– The Impaler
Mar 8 at 20:45
Why didn't I spot it? Sigh.
– The Impaler
Mar 8 at 20:45
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55070617%2fquery-showing-when-a-rental-is-overdue%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
LIMIT
withoutORDER BY
makes little sense.– The Impaler
Mar 8 at 20:35
oh my! let me try it with an ORDER BY rent_date.
– Devin Cavallero
Mar 8 at 20:37
Error 1064 usually points to the place in the code with the error.
– Gordon Linoff
Mar 8 at 20:39
I added the ORDER BY rent_date; still getting error 1064 it seems to be pinpointing line 7 which is "limit 7"
– Devin Cavallero
Mar 8 at 20:41