|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
Select rows with 00
I have this SQL Query
Code:
SELECT * FROM cards WHERE (cards.worth =2 AND cards.deny =0) AND NOT EXISTS ( SELECT alttext FROM user_inventory WHERE cards.alttext = user_inventory.alttext AND user_inventory.name = '".$person."' ) ORDER BY RAND() LIMIT 1 Which works fine, but if a person has a card blank in the inventory (blank urls have 00.png in the end, ie: http://midnighttempest.com/images/cards/final00.png) it doesn't pick those up, and i'm not sure how to change it so that it does. If i add a Code:
OR user_inventory LIKE '%00.png' How do i need to change it? |
|
#2
|
|||
|
|||
|
From what I see , user_inventory is a table name. You have to use the column name that contains the url in the LIKE clause.
__________________
What you get is either what you desired or what you deserved. Death seems to be such an abominable thing, but do we really want to live for ever? |
|
#3
|
||||
|
||||
|
i meant
Code:
OR user_inventory.url LIKE '%00.png' |
|
#4
|
||||
|
||||
|
I have the query working, but is there anyway to make it better since its quite long
Code:
SELECT * FROM cards WHERE ( cards.worth =2 AND cards.deny =0 ) AND NOT EXISTS ( SELECT alttext FROM user_inventory WHERE cards.alttext = user_inventory.alttext AND user_inventory.name = 'Desbrina' AND user_inventory.worth =2 ) OR EXISTS ( SELECT alttext FROM user_inventory WHERE ( cards.alttext = user_inventory.alttext AND user_inventory.url LIKE '%00.png' ) AND user_inventory.name = 'Desbrina' AND user_inventory.worth =2 ) ORDER BY RAND( ) LIMIT 1 |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Select rows with 00 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|