我正在从两个表中提取数据。但我收到骚扰repeatation,所以我想在不同的关键字得到的只是不同的记录,但它没有工作SQL不同的关键字问题
SELECT distinct fb_event.id AS rid, fb_event.eventname AS sevntname,
fb_event.location AS slocation, fb_event.startdate AS sstartdate,
fb_event.enddate AS senddate,
cast(fb_event.CATEGORY as text) AS sCATEGORY, cast(fb_event.tags as text) AS stags,
cast(fb_event.description as text) AS sdescription,
cast(fb_event.eventid as text) AS seventid,
cast(fb_event.city as text) AS scity, cast(fb_event.venue as text) AS svenue,
cast(fb_event.country as text) AS scountry, cast(fb_event.postalcode as text) AS spostalcode,
cast(fb_event.keyword as text) AS skeyword,
cast(fb_userevents.userid as text) AS suserid,fb_event.longitude as long, fb_event.altitude as alt,fb_event.attending
FROM fb_event INNER JOIN
fb_userevents ON fb_event.eventid = fb_userevents.eventid order by fb_event.eventid
错误: 消息145,级别15,状态1,行1 ORDER BY项目必须出现在选择列表中,如果指定了SELECT DISTINCT。
我失踪了。任何形式的帮助,不胜感激。
您必须在您的选择列表中有** b_event.eventid ** –
也许您应该在查询中使用“Order By”。看看这些文章 –