Jump to content

help :( before i break my laptop :D


bamfon

Recommended Posts

my code is this

 

SELECT * FROM  episodea, episodeb WHERE episodea.animeid = '1' OR episodeb.animeid = '1' 

 

i want the code to check the the to tables to get the data from the row's thats got animeid "1" but it keep showing  data from the row thats got 2 as its animeid :s

Link to comment
Share on other sites

well animeid has to be saved in table episodea or table episodeb  set it up that wau because latter on the tables will have a few million rows, so i made 2 forms one saves info to episodea the other to episodeb, both of the tables will never have the same animeid.

Link to comment
Share on other sites

seems that you didn't understand my answer... lets try with an example:

 

Table A

id_a

 

Table B

id_b

 

Rows Values in Table A

1

2

 

Rows Values in Table B

1

2

 

CARTESIAN PRODUCT between Table A and Table B (result from a SELECT  like yours)

1 - 1

1 - 2

2 - 1

2 - 2

 

applying your conditions

WHERE episodea.animeid = '1' OR episodeb.animeid = '1' 

 

Final result

Rows 1 - 1 and 2 - 1

 

more clear?

 

Link to comment
Share on other sites

if you data type is INT(11) ideally you should be using numbers no '1'... and to fix an omission in my previous answer...

 

......

CARTESIAN PRODUCT between Table A and Table B (result from a SELECT  like yours)

1 - 1

1 - 2

2 - 1

2 - 2

 

applying your conditions

WHERE episodea.animeid = '1' OR episodeb.animeid = '1'

 

 

Final result

Rows 1 - 1 and 2 - 1

 

in reality the final result is

Rows 1 - 1, 1 - 2 and 2 - 1

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.