5
Contributors
19
Replies
33
Views
6 Years
Discussion Span
Last Post by debasisdas
Featured Replies
  • 1

    Explain what you want with an example please. Read More

  • what you have tried so far ? Read More

  • 1

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

  • [QUOTE=silvercats;1629480]I didn't .where?[/QUOTE] In post no 5 of this thread. just use [CODE]SELECT table1.col1,table1.col2,table2.col1 FROM table1,table2[/CODE]without any join. but output may not be as expected as the result is a cross product in absence of any join.. Read More

0

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?

0

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.

Edited by silvercats: n/a

0

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??

0

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}

???

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

(This is in response to your original question)

Edited by Brillig: n/a

0

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

Edited by pritaeas: n/a

0

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

Edited by silvercats: n/a

1

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..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.