Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8768107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:59:11+00:00 2026-06-13T16:59:11+00:00

INSERT INTO Activity_Feed (userID,Type,DataIDs,PodID) VALUES ( 1437 , ‘eventattend’ , (SELECT LEFT(EventID, LEN(eventID) –

  • 0
INSERT INTO Activity_Feed (userID,Type,DataIDs,PodID) 
VALUES ( 1437
      , 'eventattend'
      , (SELECT LEFT(EventID, LEN(eventID) - 1 as nvarchar) 
         FROM ( 
            SELECT EventiD + ', ' 
            FROM   events 
            FOR XML PATH ('')) c (EventID))
      , 5)

Basically I want to take a bunch of IDs from a table and insert them as a comma delimited string into a varchar field.

E.g.

Activity_Feed (table)

activityID   1
userID       2
DataIDs      1,3,4,56,367 // This would be the (Select Ids FROM bit)

I want to take a bunch of RSVP IDs from a table and stick their IDs in the field…

To further explain I wanted to avoid normalizing the query because of the nature of this query. Let me know if I should still separate out the data…

The activity feed works like this…

I create a new entry in activity with a type of event_attending (which is an event I am attending.

I timestamp it, I enter the ID for the event in the dataIDs field any new activity matching event_attending in a 6 hour period fires an update record rather than insert

I keep the timestamp the same but update the ID’s that are associated with that time period so basically update the IDs with the latest event attendance within that time period.

I thought normalizing seemed like overkill 😀 is there such thing as overkill with normalization?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:59:12+00:00Added an answer on June 13, 2026 at 4:59 pm

    Always normalize your database.

    This is totally not wrong but very poor in database design.

    Reasons why this is very poor:

    • hard to join tables
    • hard to find values

    Why not create table like this,

    Activity

    • ActivityID
    • ActivityName

    Feed

    • FeedID
    • FeedName

    Activity_Feed

    • FeedID
    • ActivityID

    so Activity_Feed table will contain something like this

    FeedID  ActivityID
    =====================
    1         1
    1         2
    1         3
    2         1
    2         3
    3         2
    3         1
    

    and you can now join the tables,

    SELECT  a.ActivityName, c.FeedName
    FROM    Activity a
            INNER JOIN Activity_Feed b
                ON a.ActivityID = b.ActivityID
            INNER JOIN Feed c
                ON b.FeedID = c.FeedID
    -- WHERE  a.ActivityName = 1             -- or something like this
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

INSERT INTO files (fileUID, filename) WITH fileUIDS(fileUID) AS ( VALUES(1) UNION ALL SELECT fileUID+1
INSERT INTO [Tasks] ([LoginName] ,[Type] ,[Filter] ,[Dictionary] ,[Description]) Select N'Anonymous',4,'SomeTable.targetcode in (select Code from
INSERT INTO [Temp].[dbo].[Student] ([Fname], [Lname], [Gender]) VALUES (N'Aname', N'Alname', N'Male') GO This codes workes
INSERT INTO options (owner, name, value, modified) SELECT owner, name, value, modified, @draft:=draft FROM
INSERT INTO `ree`.`media` (`CREATEDATE`, `FILETYPE`, `MIMETYPE`, `MLSNUMBER`, `MODIFYDATE`, `POSITION`, `URL`) VALUES ('2011-12-27T15:00:16', 'PRIMARY PHOTO',
INSERT INTO table_a (col_tinyint, col_varchar) SELECT 0, distinct(col_other_varchar) COLLATE utf8_bin FROM table_b I want
INSERT INTO item_quotation (item_id, quotation_id,name_searched,item_name,other_name,selling_price,discounted_price) SELECT DISTINCT I.item_id, . $quotation_id . ,T.item_name, I.name,I.other_name, INV.selling_price,
insert into Attributes (Id, Disabled, AttributeValue) values (@id, @disabled, @attr_value) if not exists (
INSERT INTO details (idactivity,user,hours,val,date) VALUES ('981','133','0','10500','2008-07-01'),('981','184','0','2750','2008-07-01'),('981','184','0','2750','2008-07-01') (iddetails as details table PK) Is there a
$dotheactvity = $db->db_exec(INSERT INTO activity (notification, by, on, extra, extra2) VALUES ('$nou', '$nome', '$tehtime',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.