'why i am getting error like this ? Error Code: 1140. In aggregated query without GROUP BY, expression #1 of SELECT list contains non aggregated column
SELECT vp.visitor_id , vp.name ,vp.email ,count(n.notification_id)
from visitor_profile vp join notification n on n.receiver_id = vp.visitor_id
where n.status = 0
and vp.visitor_id in (66578,66579);
Solution 1:[1]
Columns that aren't aggregated must be specified in the GROUP BY clause:
SELECT vp.visitor_id,
vp.name,
vp.email,
COUNT(n.notification_id)
FROM visitor_profile vp
JOIN notification n ON n.receiver_id = vp.visitor_id
WHERE n.status = 0
AND vp.visitor_id IN(66578, 66579)
GROUP BY vp.visitor_id, vp.name, vp.email; --> missing
Solution 2:[2]
`Change sql mode to full groupBy by running query below
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
`
Solution 3:[3]
const obs1 = fromEvent(window,'beforeunload')
const obs2 = this.store.select(aBooleanObservable)
const result: Observable<boolean>= combineLatest(obs1, obs2).pipe(
filter((event, obvBoolean) => event && obvBoolean));
Solution 4:[4]
I am not sure if this would work, the following answer assumes obs1 only triggers once. you could try
const obs1 = fromEvent(window,'beforeunload')
const obs2 = this.store.select(aBooleanObservable)
const result: Observable<boolean>= obs1
.pipe(
switchMap(()=> obs2 ),
filter((aBooleanObservableRes)=>aBooleanObservableRes)
)
Your result will only be returned when obs2 has a "true" boolean value.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Littlefoot |
| Solution 2 | ijaz khan |
| Solution 3 | |
| Solution 4 | wscttc |
