Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 SQL query on Topic name help
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

StephenD
Senior Member

Australia
1044 Posts

Posted - 25 October 2006 :  06:07:25  Show Profile  Send StephenD a Yahoo! Message  Reply with Quote
I've got a relatively small sized db now with 3850 topics. The topic name is unique in that I append a case no. to the end of the topic name that looks like: 4356/2006 or 4357/2006.

What I am trying to do is when posting a new topic (case) I query the db and display in post.asp the next available case no based on the highest number in the first part of that case no. + 1 so in the above example 4358/2006 will be the next suggested case no.

Then again I suppose I could create a new table with autonumber starting at last case no. linked to topic_id that I would insert a record into same time the topic gets posted, then upate forum_topics T_SUBJECT with the appended case no.

SELECT T_SUBJECT INTO FORUM_TEMPXX FROM FORUM_TOPICS WHERE RIGHT(T_SUBJECT,1)='6'
UPDATE FORUM_TEMPXX SET T_SUBJECT = RIGHT(T_SUBJECT,9)
UPDATE FORUM_TEMPXX SET T_SUBJECT = LEFT(T_SUBJECT,4)<

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 25 October 2006 :  06:23:30  Show Profile  Visit HuwR's Homepage  Reply with Quote
quote:
Then again I suppose I could create a new table with autonumber starting at last case no. linked to topic_id that I would insert a record into same time the topic gets posted, then upate forum_topics T_SUBJECT with the appended case no.

This would be the prefered way to do it, rather than parsing the text of the subject in your query.<
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.15 seconds. Powered By: Snitz Forums 2000 Version 3.4.07