without 'joining'

Recommended Answers

All 19 Replies

Explain what you want with an example please.

let's say we have Table1 and Table2
We want to select col1 and col2 from table2 and another one column from table1.
how to do that?

what you have tried so far ?

ah again,the one who asks questions always lol :p
mm......this

SELECT table1.col1,table1.col2,table2.col1
      FROM table1,table2
      WHERE table1.[PK]=table2.[FK}

how about that?
please give me an answer instantly because I have a lot to study and I have only two more days for my exam

thanks.

what I meant by PK and FK is this
if we have subject's subcode as PK in subject table
we take subcode as student table's FK .and then write about command like that??

Also tell me is this how to create VIEW for above one.Please try to answer all 3 of my posts :)

CREATE VIEW myname AS 
SELECT table1.col1,table1.col2,table2.col1
      FROM table1,table2
      WHERE table1.[PK]=table2.[FK}

???

select (select col1 from table1 where...) as fname1, (select col2 from table2 where..) as fname2

(This is in response to your original question)

Correct on the join and view. Don't you have a mysql server to try this on ? Would be very convenient.

I tried few on an Online web hosting site which supports mysql .I got my firstly created databases deleted.now I have to create them again...to test this which I can't because I have only left two days for everything! (not for just SQL).and dloading SQL,installing and creating tables on local PC will take time too

you want without join, right ?

yes coz joining is confusing

then why are you using JOIN.

Go for a Cartesian product.

If you download something like wampserver (.com), you'll be done in a few minutes.

Are you trying to do this in php or just in mysql?

then why are you using JOIN.

Go for a Cartesian product.

I didn't .where?

Are you trying to do this in php or just in mysql?

just mysql

I didn't .where?

In post no 5 of this thread.

just use

SELECT table1.col1,table1.col2,table2.col1
FROM table1,table2

without any join.

but output may not be as expected as the result is a cross product in absence of any join..

you mean i won't get full mark for writing that without "Join" ?

No

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.