Bendude14 Posted March 22, 2009 Share Posted March 22, 2009 ok i am having a problem with this query, if someone could help it would be much appreciated. "SELECT RegNumber, Manufacturer, Model, Km, Transmission FROM Cars WHERE RegNumber=' (SELECT DateIn, RegNumber FROM Cars WHERE DateIn < '" & Now.AddDays(7) & "')'" I have tried this but it dont seem to be working... Thanks ben Quote Link to comment https://forums.phpfreaks.com/topic/150555-sub-query-problems/ Share on other sites More sharing options...
Mchl Posted March 22, 2009 Share Posted March 22, 2009 I think you don't need '' quotes around a subquery Quote Link to comment https://forums.phpfreaks.com/topic/150555-sub-query-problems/#findComment-790811 Share on other sites More sharing options...
Bendude14 Posted March 22, 2009 Author Share Posted March 22, 2009 Thanks for that, I found a few other problems and the query runs now but it does not seem to be returning the data i was expecting. "SELECT RegNumber, Manufacturer, Model, Km, Transmission FROM Cars WHERE RegNumber= (SELECT RegNumber FROM Rental WHERE DateIn < '" & Now.AddDays(7) & "')" I am trying to select RegNumber etc from the Cars table WHERE the reg number equals thats of a registration number in the Rental table with a return date (DateIn) less than 7 days from now. I am using VB hence the Now.AddDays, but i figure the SQL is the same. Thanks Ben Quote Link to comment https://forums.phpfreaks.com/topic/150555-sub-query-problems/#findComment-790825 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.