Fill Recordset with "fixed value"?

Results 1 to 3 of 3

Thread: Fill Recordset with "fixed value"?

  1. #1
    Join Date
    Dec 1969
    Posts
    417

    Default Fill Recordset with "fixed value"?

    Hey gang, got one I can&#039;t figure out...<BR>Two tables, EXACT sames column names, selecting data from both tables into one "recordSet/resultSet" using union..<BR><BR>strSQL = "Select ItemDueId, ItemDueDate FROM tblActionsDue "&_<BR>"WHERE ItemDueId &#062; 12000 "&_<BR>"UNION "&_<BR>"Select ItemDueId, ItemdDueDate FROM tblLettersDue "&_<BR>"WHERE ItemDueId &#062; 12000 "&_<BR>"ORDER BY (2) " <BR>This query returns the records as expected. When "looping" through the records on the asp page, I need to determine what table the record came from? In other words, is it an action due, or a letter due? Is there a way to create an additional column with a pre-determined value? Like???<BR>"Select ItemDueId, ItemDueDate, Item="ACTION" "&_<BR>"WHERE ItemDueId &#062; 12000", etc. etc. Doing the same thing on the second select with Item="LETTER". This way, when looping through the records I could do a ..<BR> Select Case objRS("Item")<BR> Case "Letter"<BR> ...Do This...<BR> Case "Action"<BR> ...Do This<BR> End Select<BR><BR>Kinda crazy question I think?<BR>Thanks in advance.<BR>David

  2. #2
    Join Date
    Dec 1969
    Posts
    3,921

    Default Fairly easy

    strSQL = "Select ItemDueId, ItemDueDate, &#039;ACTION&#039; as RECTYPE FROM tblActionsDue "&_<BR>"WHERE ItemDueId &#062; 12000 "&_<BR>"UNION "&_<BR>"Select ItemDueId, ItemdDueDate, &#039;LETTER&#039; as RECTYPE FROM tblLettersDue "&_<BR>"WHERE ItemDueId &#062; 12000 "&_<BR>"ORDER BY (2) " <BR> <BR> <BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    417

    Default Exactly what i needed THANKY YOU!!! EOP

    .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •