我有下表:
PriceEntry
CarType
ID
CarName
人
我想要达到的结果就是这个(获取所有人的名字):
2018年6月28日,星期四安迪空NULL空
2018年6月28日星期四,皮特·奥迪5000
2018年6月28日星期四巴特奥迪10000
但是我拥有的是:
2018年6月28日星期四,皮特·奥迪5000
2018年6月28日星期四巴特奥迪10000
这是我的查询:
SELECT (
DATENAME(dw, CAST(DATEPART(m, priceDate) AS VARCHAR) + '/' + CAST(DATEPART(d, priceDate) AS VARCHAR) + '/' + CAST(DATEPART(yy, priceDate) AS VARCHAR))
+ ' '+ FORMAT(priceDate, 'dd MMMM yyyy') )as 'Entering Date', p.Name as 'Person Name', CarName as 'CarName' , REPLACE(ap.priceValue,'.',',') as 'Price'
FROM PriceEntry ap
FULL JOIN CarType at
ON ap.CarTypeID = at.id
FULL JOIN Person p
ON ap.PersonId = p.ID
order by priceDate desc
我在做什么错?
编辑
我的数据:
SELECT
* from PriceEntry
WHERE priceDate = '2018-07-09 00:00:00.000'
select count(*) as 'Person count' from person
select count(*) as 'car count' from CarType
我今天只用查询返回了1行,而我希望今天所有人返回的行
答案 0 :(得分:1)
这是我对您查询的建议:
SELECT DATENAME(dw, priceDate) + ' '+ FORMAT(priceDate, 'dd MMMM yyyy') )as Entering_Date,
p.Name as Person_Name,
at.CarName as Car_Name,
REPLACE(ap.priceValue, '.', ',') as Price
FROM Person p LEFT JOIN
PriceEntry ap
ON ap.PersonId = p.ID LEFT JOIN
CarType at
ON ap.CarTypeID = at.id
ORDER BY ap.priceDate DESC;
注意:
left join
系列中的第一个参与者。编辑:
您在已编辑问题中的查询与您所描述的完全不同。解决方案就是简单地将条件放在适当的on
子句中:
这是我对您查询的建议:
SELECT DATENAME(dw, priceDate) + ' '+ FORMAT(priceDate, 'dd MMMM yyyy') )as Entering_Date,
p.Name as Person_Name,
at.CarName as Car_Name,
REPLACE(ap.priceValue, '.', ',') as Price
FROM Person p LEFT JOIN
PriceEntry ap
ON ap.PersonId = p.ID and ap.priceDate = '2018-07-09 LEFT JOIN
CarType at
ON ap.CarTypeID = at.id
ORDER BY ap.priceDate DESC;
答案 1 :(得分:-1)
快到了。您需要使用File: notifyTest.py
#!/usr/bin/python3
import sdnotify
import sched, time #for calling function every 30s
time_interv_watchdog = 5 #interval to send life signal to watchdog
#create notifier
notifier = sdnotify.SystemdNotifier()
#notify for the first time
notifier.notify("STATUS=1")
# Creating scheduler for watchdog calling
watchdogScheduler = sched.scheduler(time.time, time.sleep)
def call_watchdog(sc):
print("calling the watchdog...")
#notifing
notifier.notify("STATUS=1")
watchdogScheduler.enter(time_interv_watchdog, 1, call_watchdog, (sc,))
#starting notifications on a regular basis
watchdogScheduler.enter(time_interv_watchdog, 1, call_watchdog, (watchdogScheduler,))
watchdogScheduler.run()
:
LEFT JOIN