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 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 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 Link to comment https://forums.phpfreaks.com/topic/150555-sub-query-problems/#findComment-790825 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.