473,395 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

using like and where in a joined query.

Hi im doing the following query

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM networkinfo JOIN tblimage WHERE networkinfo.network LIKE '$data' && networkinfo.network = tblimage.imgdata && networkinfo.category = '$category'
so I can get it to work untill I add the last

Expand|Select|Wrap|Line Numbers
  1. && networkinfo.category = '$category'
this kills the whole query what am I doing wrong? I think it has to do with using the like and where in the same query because I havnt run into this issue before the query seems simple enough to me.

Thanks
Dec 21 '09 #1
5 1548
ssnaik84
149 100+
check for following conditions -
1) if you are using "JOIN", you should use "ON" keyword to map tables
2) if networkinfo.category is integer, then remove single quote (')
3) try using "AND" instead of "&&"
Dec 22 '09 #2
ssnaik84
149 100+
try printing your SQL stmt variable. and run directly on Query Browser
Dec 22 '09 #3
mwasif
802 Expert 512MB
What do you mean by 'kills the whole query'?

Don't mix JOIN with WHERE clause. Try the following

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM networkinfo 
  2. INNER JOIN tblimage 
  3.  ON networkinfo.network = tblimage.imgdata
  4. WHERE networkinfo.network LIKE '$data' AND networkinfo.category = '$category'
Dec 22 '09 #4
nbiswas
149 100+
Try this

SELECT * FROM networkinfo
JOIN tblimage
ON networkinfo.network = tblimage.imgdata
WHERE networkinfo.network LIKE '%data'
AND networkinfo.category = 'category'

Like should be '%data' as far as I know.
and Join condition should be before the where condition

Hope this helps
Dec 23 '09 #5
great that fixed everything......... : )
Dec 28 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Andrew | last post by:
With command-line interface ( 3.23.37, UNIX Socket ) all is well with column aliasing. However, column aliases disappear in Excel, over ODBC, when there are multiple (joined) tables in the query. ...
2
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
1
by: Michael | last post by:
I have a query that uses two joined tables. The query contains data. I would like to pull in a data drom another table but when I add that table to the query design and make the join,the existing...
1
by: Carl B Davis | last post by:
Help please!!! I am an intermediate access user that is getting my bottom kicked by what seems an easy problem to fix. I maintain an employee database at work. I have set up a query from two tables...
6
by: Bill R via AccessMonster.com | last post by:
I have a query: SELECT tblCalendar.CalendarDay AS LastSunday FROM tblCalendar WHERE (((tblCalendar.CalendarDay)>=(Now()-7) And (tblCalendar.CalendarDay)...
1
by: Ersin Gençtürk | last post by:
hi , I have 2 tables , tUser and tUserRole and I have a query like : select * from tUser inner join tUserRole on tUserRole.UserId=tUser.UserId where tUser.UserId=1 this will return a user...
4
by: Nathan | last post by:
I have an application that uses an Access database to gather information on students' test scores. In the database there are three tables which are joined by one- to-many relationships: ...
1
by: Ike | last post by:
I have a simple query of joined tables that is failing to give me any rows of data (though, in checking by hand, it certainly should). Essentially, I am trying to return all rows from `ups` that...
3
by: loosecannon_1 | last post by:
I get a 90-120 second blocking when send 15 or so simultaneous queries to SQL Server 2000 that query a view made up of two joined tables. After each query is blocking for the same amount of time...
1
by: gus1339 | last post by:
Does anyone know how to do this? a query to show only rows where joined fields from both table are NOT equal Thanks!
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.