Professional Web Applications Themes

phantom records - MySQL

Hi all: I would like to know how to create a "phantom" record when running a SELECT query. For example: Running "Select ID, Firstname, Lastname from Customers order by Lastname" would produce a list all the records in the Customers table such as: 1 John Brown 2 Anne Johnsen 3 Tom Smith But I would like the first the result of such a query to contain a "virtual record", i.e information that I have manually inserted into the query and does not correspond to any record. So, by way of an example how do I ensure a return like this: ...

  1. #1

    Default phantom records

    Hi all:

    I would like to know how to create a "phantom" record when running a
    SELECT query.

    For example:

    Running "Select ID, Firstname, Lastname from Customers order by
    Lastname" would produce a list all the records in the Customers table
    such as:

    1 John Brown
    2 Anne Johnsen
    3 Tom Smith


    But I would like the first the result of such a query to contain a
    "virtual record", i.e information that I have manually inserted into
    the query and does not correspond to any record.

    So, by way of an example how do I ensure a return like this:

    0 PETER JENSEN
    1 John Brown
    2 Anne Johnsen
    3 Tom Smith

    when there is no record containing the information "0 Peter Jensen"?

    Thanks.

    TB

    TB Guest

  2. #2

    Default Re: phantom records

    TB wrote:
    > So, by way of an example how do I ensure a return like this:
    >
    > 0 PETER JENSEN
    > 1 John Brown
    > 2 Anne Johnsen
    > 3 Tom Smith
    >
    > when there is no record containing the information "0 Peter Jensen"?
    Does this do what you want?

    SELECT 0 AS ID, 'PETER' AS Firstname, 'JENSEN' AS Lastname
    UNION ALL
    SELECT ID, Firstname, Lastname FROM Customers ORDER BY Lastname

    You can also order the whole unioned set by using parens:

    (SELECT ...
    UNION
    SELECT ...)
    ORDER BY ...

    Regards,
    Bill K.
    Bill Karwin Guest

  3. #3

    Default Re: phantom records

    Hi

    Thanks for replying

    The thread continues here:
    [url]http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_frm/thread/d01f4dd4ade5f29c/305307c99c76b3dc?tvc=1#305307c99c76b3dc[/url]

    TB Guest

Similar Threads

  1. Phantom Transparency (?!) CS2
    By FARBgerECHT@adobeforums.com in forum Adobe Indesign Macintosh
    Replies: 2
    Last Post: September 25th, 11:17 AM
  2. Phantom CFIDE folder?
    By Sadus69 in forum Coldfusion Server Administration
    Replies: 4
    Last Post: August 30th, 12:52 PM
  3. phantom fonts
    By Diane_Scheaffer@adobeforums.com in forum Adobe Indesign Windows
    Replies: 5
    Last Post: August 13th, 05:42 PM
  4. Phantom keylines when printing
    By Cheryl_Quinn@adobeforums.com in forum Adobe Indesign Windows
    Replies: 2
    Last Post: April 22nd, 01:07 PM
  5. Phantom Downloads
    By Ed Wurster in forum Adobe Photoshop Elements
    Replies: 3
    Last Post: August 5th, 03:38 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139