我想找到所有在18岁之前购买汽车的用户。
我需要这样的查询:
Option Explicit
Sub ShowOtherUserCalFolders1()
Dim CalendarFolder As Folder
Dim oItems As items
Dim currFolder_entryID As String
' Walk the folder tree to the applicable folder
' Right click on folder | Properties
' General Tab | Location
' \\Highest level name of shared Boardrooms\subfolder
Set CalendarFolder = Session.folders("Highest level name of shared Boardrooms")
Set CalendarFolder = CalendarFolder.folders("subfolder")
Set CalendarFolder = CalendarFolder.folders("boardroom name")
Set ActiveExplorer = CalendarFolder
Set oItems = CalendarFolder.items
MsgBox CalendarFolder & " has " & oItems.count & " items"
End Sub
如何使用Postgresql在Rails 5中编写这样的查询?谢谢
答案 0 :(得分:0)
尝试以下
@IBAction func unwind(segue: UIStoryboardSegue) {
viewController?.dismiss(animated: true)
self.performSegue(withIdentifier: "unwindToMap", sender: self)
}
override func viewDidLoad() {
super.viewDidLoad()
//Check for Location Services
if (CLLocationManager.locationServicesEnabled()) {
myLocationManager = CLLocationManager()
myLocationManager.delegate = mapViewDelegate as? CLLocationManagerDelegate
myLocationManager.desiredAccuracy = kCLLocationAccuracyBest
myLocationManager.requestAlwaysAuthorization()
myLocationManager.requestWhenInUseAuthorization()
}
mapViewDelegate = searchBox.text as? MKMapViewDelegate
}
@IBAction func searchButtonClick(_ sender: Any) {
let location = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
let span = MKCoordinateSpanMake(0.005, 0.005)
let region = MKCoordinateRegion(center: location, span: span)
let annotation = MKPointAnnotation()
annotation.coordinate = location
annotation.title = searchBox.text!
/*
//find the words
let _ : UITextPosition = searchBox.beginningOfDocument
let _ : UITextPosition = searchBox.endOfDocument
let _ : UITextRange = searchBox.selectedTextRange!
// Get cursor position
if let selectedRange = searchBox.selectedTextRange {
_ = searchBox.offset(from: searchBox.beginningOfDocument, to: selectedRange.start)
}
searchBox.selectedTextRange = searchBox.textRange(
from: searchBox.beginningOfDocument, to: searchBox.endOfDocument)
*/
// myMapView.add(location as! MKOverlay)
myMapView.addAnnotation(annotation)
myMapView.setRegion(region, animated: true)
}
确保数据库列User.includes(:car).where( 'cars.bought_at < ?', user.birthday + 18.years)
和bought_at
为birthday
格式。
希望能提供帮助