Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

[b]is it possible?!?......[/b]

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

[b]is it possible?!?......[/b]

Postby cho@ » Thu Aug 29, 2002 9:23 am

I knw dat its possible to force mysql to create a temporary table with the option

SQL_BUFFER_RESULT

but i like to knw if its possible to do a SELECT in this table ??????? and if yes how?

My prob is that i wanna do a kind of left jonction on the same table ?!?...I knw its sounds wierd but its like dat....

So i have two queries
the first one:
SELECT LName, FName, forum.date, views, content, idlink, forum.id FROM member, forum WHERE forum.type LIKE 'topic' AND forum.authorID = member.ID ORDER BY date DESC

the second one
SELECT t1.*, t2.date FROM forum AS t1, forum AS t2 WHERE t1.id = t2.idlink ORDER BY t2.date DESC

I d like to do the second one on the result of the first one....
is it possible...
thanxs for your help

cho@ :)
cho@
New php-forum User
New php-forum User
 
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

Postby DoppyNL » Thu Aug 29, 2002 10:55 am

why not try to make it 1 query?

can't check it here, maybe this one works:
Code: Select all
SELECT LName, FName, forum1.*, views, content, forum2.idlink, forum2.date FROM member, forum as forum1, forum as forum2 WHERE forum1.type LIKE 'topic' AND forum1.authorID = member.ID AND forum1.id = forum2.idlink ORDER BY date DESC


another solution can be to run the 2 query's and store them in 2 array's.
the walk through the arrays and remove what you don't want, this is a bit slower though.

Greetz Daan
DoppyNL
 

Postby cho@ » Fri Aug 30, 2002 1:23 am

dvdbinternet wrote:SELECT LName, FName, forum1.*, views, content, forum2.idlink, forum2.date FROM member, forum as forum1, forum as forum2 WHERE forum1.type LIKE 'topic' AND forum1.authorID = member.ID AND forum1.id = forum2.idlink ORDER BY date DESC



With this query i have only the topic where a reply has been post in fact i wanna (furthermore it gives me x time the topic if there is x replies):

SELECT * FROM forum WHERE type LIKE 'topic'

and i wanna LEFT JOINT with the date of the last post (if there is a last post)
like that if there is a last post then it gives me the date of the last post
or else the date of the post of the topic....

thank you
cho@
cho@
New php-forum User
New php-forum User
 
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

Postby cho@ » Fri Aug 30, 2002 2:51 am

another solution can be to run the 2 query's and store them in 2 array's.
the walk through the arrays and remove what you don't want, this is a bit slower though.


That was my first though and it works good.(in a multidimention array)..but i though like u just told me that it will be slower....

So till i find the magic query :wink: i ll keep my array...

thanx V much
cho@
New php-forum User
New php-forum User
 
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK


Return to PHP coding => General

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron