Author |
Topic |
Swatig
Starting Member
7 Posts |
Posted - 2008-06-24 : 18:43:53
|
Hi Can anybody let me know what is wrong in my query here. What should be the correct one:SELECT m.user_name as USER, p.photo AS IMAGEFROM station.user_profiles p ,station.user_master mwherem.user_name like 'p%'andp.email_id='prasenjit@gmail.com'andfull_name='prasenjit'andpassword='747435jfk9'anddate_of_birth='2005-01-01'; |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-24 : 18:57:55
|
There is no correlation defined between the two tables user_profiles and user_master. E 12°55'05.25"N 56°04'39.16" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-24 : 19:45:56
|
<<Can anybody let me know what is wrong in my query here>>You have posted without giving any other informations MadhivananFailing to plan is Planning to fail |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-25 : 00:55:20
|
quote: Originally posted by Swatig Hi Can anybody let me know what is wrong in my query here. What should be the correct one:SELECT m.user_name as USER, p.photo AS IMAGEFROM station.user_profiles p ,station.user_master mwherem.user_name like 'p%'andp.email_id='prasenjit@gmail.com'andfull_name='prasenjit'andpassword='747435jfk9'anddate_of_birth='2005-01-01';
The query doesnt have any syntax errors as such. But what you've given is just taking a cross join b/w two tables with some fielters conditions which i dont think was your requirement. If you can post why you think this query is not working for you with some info on what you really want to achieve, we will be able to help. |
|
|
Swatig
Starting Member
7 Posts |
Posted - 2008-06-25 : 15:51:38
|
Thanks for reposnding Now I tried to join two table with Inner Join clause. So the query is like that:SELECT m.user_name AS USER, p.photo AS IMAGEwherem.user_name like 'p%'andp.email_id='prasenjit@gmail.com'andfull_name='prasenjit'andpassword='747435jfk9'anddate_of_birth='2005-01-01'FROM station.user_profiles p INNER JOIN station.user_master mON station.user_profiles p =station.user_master m;But it still not giving output. Is there is something wrong with Syntex?quote: Originally posted by Peso There is no correlation defined between the two tables user_profiles and user_master. E 12°55'05.25"N 56°04'39.16"
|
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-25 : 16:09:23
|
[code]SELECT m.user_name AS USER, p.photo AS IMAGEFROM station.user_profiles as pINNER JOIN station.user_master as m ON m.{Some column} = p.{Some column}where m.user_name like 'p%' and p.email_id = 'prasenjit@gmail.com' and {p | m}.full_name = 'prasenjit' and {p | m}.password = '747435jfk9' and {p | m}.date_of_birth = '2005-01-01'[/code] E 12°55'05.25"N 56°04'39.16" |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-26 : 00:09:18
|
quote: Originally posted by Swatig Thanks for reposnding Now I tried to join two table with Inner Join clause. So the query is like that:SELECT m.user_name AS USER, p.photo AS IMAGEFROM station.user_profiles p INNER JOIN station.user_master mON station.user_profiles p =station.user_master mwherem.user_name like 'p%'andp.email_id='prasenjit@gmail.com'andfull_name='prasenjit'andpassword='747435jfk9'anddate_of_birth='2005-01-01'But it still not giving output. Is there is something wrong with Syntex?quote: Originally posted by Peso There is no correlation defined between the two tables user_profiles and user_master. E 12°55'05.25"N 56°04'39.16"
where should come after inner join. Also we cant tell why you didint get o/p unlessw e see how your data is. so can you post some sample data too from your tables? |
|
|
Swatig
Starting Member
7 Posts |
Posted - 2008-06-27 : 14:00:40
|
Hi PesoOn my query I got this response.Can you help me please:"There are two places where you are finding user_name and full name ,we need only one search string which will operate on the both the columns .We should be giving one search parameter which will be filtering data from both columns of the table, and providing us results.Now you are selecting two columns and giving two search parameters separately , if i am searching all names starting with p then i should not give prasenjit ,or if iknow the name is prasenjit is it okay to search all names starting with p .one of these should be used instead but it should search from both the columns".I am stuck with one query for so long please get me out of it.Thanks for bearing with me.quote: Originally posted by Peso
SELECT m.user_name AS USER, p.photo AS IMAGEFROM station.user_profiles as pINNER JOIN station.user_master as m ON m.{Some column} = p.{Some column}where m.user_name like 'p%' and p.email_id = 'prasenjit@gmail.com' and {p | m}.full_name = 'prasenjit' and {p | m}.password = '747435jfk9' and {p | m}.date_of_birth = '2005-01-01' E 12°55'05.25"N 56°04'39.16"
|
|
|
|