SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old September 6th, 2004, 11:05 PM
ramyaivan ramyaivan is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 16 ramyaivan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Query Problem

hi,
How are u all doing. Now i have found a problem. This is related to query. I want to put the output of a query in a separate table.

Like say, the output of a query "select * from table1" is,
Field1 Field2
1 orange
2 Lemon


I want to put this output in a separate table, like we do in sql query using "As" command.



Any help will be greatly appreciated

Thanks in advance
ri

Reply With Quote
  #2  
Old September 6th, 2004, 11:36 PM
Maquiavel Maquiavel is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 6 Maquiavel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 11 sec
Reputation Power: 0
I couldn't understood well pretty well, please be more specific, give examples.

But, is this?
PHP Code:
<?php
$SQL 
"SELECT id, name FROM customers";
$result_id mysql_query($SQL);
printf("<table border=1 cellpadding=2 cellspacing=0 align=center>");
printf("<tr><th>Customer ID</th><th>Name</th></tr>");
while(
$data mysql_fetch_array($result_id))
{
    
printf("<tr><td align=center>" $data["id"] . "</td><td>" $data["name"] . "</td></tr>");
}
?>


Hope it helps

Reply With Quote
  #3  
Old September 7th, 2004, 10:11 AM
ramyaivan ramyaivan is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 16 ramyaivan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The same problem

Sorry for i was not too specific.

My problem is related to Mysql Query.

When you r writing a query say, SELECT ID, NAME FROM TABLE1, we get an output as
ID NAME
1 rat
2 cat


what i want is, i want to save this output as a separate table while writing the query itself, as we do in
SQL query like SELECT ID, NAME FROM TABLE1 AS TAB1, by writing a query like this in SQL, the output will be stored in a
temporary table called TAB1. I want to know whether we can do like this in MYSQL, becoz i tried and it didnt workout.

Thanks in advance for your assistance.
ri

Reply With Quote
  #4  
Old September 7th, 2004, 11:20 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 650865 Folding Title: Super Ultimate Folder - Level 2Folding Points: 650865 Folding Title: Super Ultimate Folder - Level 2Folding Points: 650865 Folding Title: Super Ultimate Folder - Level 2Folding Points: 650865 Folding Title: Super Ultimate Folder - Level 2Folding Points: 650865 Folding Title: Super Ultimate Folder - Level 2Folding Points: 650865 Folding Title: Super Ultimate Folder - Level 2Folding Points: 650865 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 32 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
You should really be posting this to the MySQL forum, but anyway.
What you want is slightly possible, it mostly depends on what you intend to do with it.
Easiest way is to join the table with itself (select * from table1 as tab1 inner join table1 as tab 2 etc)

Another way, more powerful, is with subqueries, but this hasn't been implement till MySQL 4.1, which is still in Beta.

good luck.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Query Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway